risk.ratio.approximate.confidence: Approximate Confidence intervals for the Risk Ratio Integral

Description Usage Arguments Note Author(s) References See Also Examples

View source: R/risk_ratio_approximate_confidence.R

Description

Function that approximates the confidence interval for the integral

\int RR(x;θ)f(x)dx

where f(x) is the density function of the exposure X, RR(x;θ) the relative risk of the exposure with associated parameter θ. In particular this is an approximation when only mean and variance of exposure known

Usage

1
2
3
4
risk.ratio.approximate.confidence(X, Xvar, thetahat, rr, thetavar,
  nsim = 1000, confidence = 95, deriv.method.args = list(),
  deriv.method = c("Richardson", "complex"), check_thetas = TRUE,
  force.min = FALSE)

Arguments

X

Mean value of exposure levels from a cross-sectional random sample.

Xvar

Variance of exposure levels.

thetahat

Estimator (vector or matrix) of theta for the Relative Risk function.

rr

Function for Relative Risk which uses parameter theta. The order of the parameters shound be rr(X, theta).

thetavar

Estimator of variance of thetahat

**Optional**

nsim

Number of simulations

confidence

Confidence level % (default: 95)

deriv.method.args

method.args for hessian.

deriv.method

method for hessian. Don't change this unless you know what you are doing.

check_thetas

Checks that theta parameters are correctly inputed.

force.min

Boolean indicating whether to force the rr to have a minimum value of 1 instead of 0 (not recommended).

Note

When a sample of the exposure X is available the method risk.ratio.confidence should be prefered.

The force.min option forces the relative risk rr to have a minimum of 1 and thus an rr < 1 is NOT possible. This is only for when absolute certainty is had that rr > 1 and should be used under careful consideration. The confidence interval to acheive such an rr is based on the paper by Do Le Minh and Y. .s. Sherif

Author(s)

Rodrigo Zepeda-Tello [email protected]

Dalia Camacho-Garc<c3><ad>a-Forment<c3><ad> [email protected]

References

Sherif, Y. .s. (1989). The lower confidence limit for the mean of positive random variables. Microelectronics Reliability, 29(2), 151-152.

See Also

risk.ratio.confidence for a method when there is a sample of the exposure.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## Not run: 
#' #Example 1: Exponential Relative Risk
#--------------------------------------------
set.seed(18427)
X        <- data.frame(rnorm(100))
thetahat <- 0.1
thetavar <- 0.2
Xmean    <- data.frame(mean(X[,1]))
Xvar     <- var(X[,1])
rr      <- function(X,theta){exp(X*theta)}
risk.ratio.approximate.confidence(Xmean, Xvar, thetahat, rr, thetavar)

#We can force RR'.s CI to be >= 1.
#This should be done with extra methodological (philosophical) care as 
#RR>= 1 should only be assumed with absolute mathematical certainty
risk.ratio.approximate.confidence(Xmean, Xvar, thetahat, rr, thetavar, force.min = TRUE)

#Example 2: Multivariate Relative Risk
#--------------------------------------------
set.seed(18427)
X1        <- rnorm(1000)
X2        <- runif(1000)
X         <- data.frame(t(colMeans(cbind(X1,X2))))
Xvar      <- cov(cbind(X1,X2))
thetahat  <- c(0.02, 0.01)
thetavar  <- matrix(c(0.1, 0, 0, 0.4), byrow = TRUE, nrow = 2)
rr        <- function(X, theta){exp(theta[1]*X[,1] + theta[2]*X[,2])}
risk.ratio.approximate.confidence(X, Xvar, thetahat, rr, thetavar) 

## End(Not run)

pifpaf documentation built on Sept. 29, 2017, 1:03 a.m.