Description Usage Arguments Details Examples
Assumes exposure measurements are subject to multiplicative mean-1 lognormal measurement errors, and exposure given covariates is a constant-scale Gamma regression. Parameters are estimated using maximum likelihood.
1 2 3 |
y |
Numeric vector of Y values. |
xtilde |
Numeric vector (or list of numeric vectors, if there are replicates) of 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. |
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 |
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. |
Disease model is:
logit[P(Y = 1|X, C)] = beta_0 + beta_x X + beta_c^T C
Measurement error model is:
Xtilde|X ~ LN(-1/2 sigsq_m, sigsq_m)
Exposure model is:
X|C ~ Gamma(exp(alpha_0 + alpha_c^T C), b)
using the shape-scale (as opposed to shape-rate) parameterization described
in GammaDist
.
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 | # 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_xerrors2)
dat <- dat_logreg_xerrors2$dat
reps <- dat_logreg_xerrors2$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$theta.hat
# Logistic regression of Y vs. (Xtilde, C), accounting for measurement error.
# Takes a few minutes due to numerical integration.
## Not run:
fit.corrected <- logreg_xerrors2(
y = dat$y,
xtilde = reps,
c = dat$c,
merror = TRUE,
integrate_tol = 1e-4,
control = list(trace = 1)
)
fit.corrected$theta.hat
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.