Description Usage Arguments Details Value Examples
Assumes exposure measurements are subject to additive normal measurement errors, and exposure given covariates is a normal-errors linear regression. Some replicates are required for identifiability. Parameters are estimated using maximum likelihood.
1 2 3 |
y |
Numeric vector of Y values. |
xtilde |
List of numeric vectors with Xtilde values. |
c |
Numeric matrix with C values (if any), with one row for each subject. Can be a vector if there is only 1 covariate. |
prev |
Numeric value specifying disease prevalence, allowing for valid
estimation of the intercept with case-control sampling. Can specify
|
samp_y1y0 |
Numeric vector of length 2 specifying sampling probabilities
for cases and controls, allowing for valid estimation of the intercept with
case-control sampling. Can specify |
merror |
Logical value for whether there is measurement error. |
approx_integral |
Logical value for whether to use the probit approximation for the logistic-normal integral, to avoid numerically integrating X's out of the likelihood function. |
integrate_tol |
Numeric value specifying |
integrate_tol_hessian |
Same as |
estimate_var |
Logical value for whether to return variance-covariance matrix for parameter estimates. |
... |
Additional arguments to pass to |
Disease model is:
logit[P(Y = 1|X, C)] = beta_0 + beta_x X + beta_c^T C
Measurement error model is:
Xtilde|X ~ N(0, sigsq_m)
Exposure model is:
X|C ~ N(alpha_0 + alpha_c^T C, sigsq_x.c)
List containing:
Numeric vector of parameter estimates.
Variance-covariance matrix (if estimate_var = TRUE
).
Returned nlminb
object from maximizing the
log-likelihood function.
Akaike information criterion (AIC).
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 31 32 33 34 35 36 37 38 39 | # Load data frame with (Y, X, Xtilde, C) values for 500 subjects and list of
# Xtilde values where 25 subjects have replicates. Xtilde values are affected
# by measurement error. True parameter values are beta_0 = -0.5 beta_x = 0.2,
# beta_c = 0.1, sigsq_m = 0.5.
data(dat_logreg_xerrors1)
dat <- dat_logreg_xerrors1$dat
reps <- dat_logreg_xerrors1$reps
# Logistic regression of Y vs. (X, C) (unobservable truth).
fit.unobservable <- glm(y ~ x + c, data = dat, family = "binomial")
fit.unobservable$coef
# Logistic regression of Y vs. (Xtilde, C) ignoring measurement error.
fit.naive <- glm(y ~ xtilde + c, data = dat, family = "binomial")
fit.naive$coef
# Logistic regression of Y vs. (Xtilde, C), accounting for measurement error.
# Avoiding numerical integration by using the probit approximation.
fit.approxml <- logreg_xerrors1(
y = dat$y,
xtilde = reps,
c = dat$c,
approx_integral = TRUE,
)
fit.approxml$theta.hat
# Repeat, but perform numerical integration. Takes a few minutes to run.
## Not run:
fit.fullml <- logreg_xerrors1(
y = dat$y,
xtilde = reps,
c = dat$c,
approx_integral = FALSE,
integrate_tol = 1e-4,
control = list(trace = 1)
)
fit.fullml$theta.hat
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.