logreg_xerrors1: Logistic Regression with Normal Exposure Subject to Additive...

Description Usage Arguments Details Value Examples

Description

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.

Usage

1
2
3
logreg_xerrors1(y, xtilde, c = NULL, prev = NULL, samp_y1y0 = NULL,
  merror = TRUE, approx_integral = TRUE, integrate_tol = 1e-08,
  integrate_tol_hessian = integrate_tol, estimate_var = FALSE, ...)

Arguments

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 instead if sampling rates are known.

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 prev instead if it's easier.

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 tol input to hcubature for numerical integration.

integrate_tol_hessian

Same as integrate_tol, but for use when estimating the Hessian matrix only. Sometimes using a smaller value than for likelihood maximization helps prevent cases where the inverse Hessian is not positive definite.

estimate_var

Logical value for whether to return variance-covariance matrix for parameter estimates.

...

Additional arguments to pass to nlminb.

Details

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)

Value

List containing:

  1. Numeric vector of parameter estimates.

  2. Variance-covariance matrix (if estimate_var = TRUE).

  3. Returned nlminb object from maximizing the log-likelihood function.

  4. Akaike information criterion (AIC).

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
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)

vandomed/meuc documentation built on May 12, 2019, 6:17 p.m.