ndfa: Normal Discriminant Function Approach for Estimating Odds...

Description Usage Arguments Value References Examples

Description

Assumes exposure given covariates and outcome is a normal-errors linear regression. Exposure measurements can be assumed precise or subject to additive normal measurement error. Some replicates are required for identifiability. Parameters are estimated using maximum likelihood.

Usage

1
ndfa(y, xtilde, c = NULL, constant_or = TRUE, merror = 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.

constant_or

Logical value for whether to assume a constant odds ratio for X, which means that sigsq_1 = sigsq_0. If NULL, model is fit with and without this assumption, and a likelihood ratio test is performed to test it.

merror

Logical value for whether there is measurement error.

...

Additional arguments to pass to nlminb.

Value

List containing:

  1. Numeric vector of parameter estimates.

  2. Variance-covariance matrix.

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

  4. Akaike information criterion (AIC).

If constant_or = NULL, two such lists are returned (one under a constant odds ratio assumption and one not), along with a likelihood ratio test for H0: sigsq_1 = sigsq_0, which is equivalent to H0: odds ratio is constant.

References

Lyles, R.H., Guo, Y., and Hill, A.N. (2009) "A fresh look at the discriminant function approach for estimating crude or adjusted odds ratios." Am. Stat 63(4): 320–327.

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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Load data frame with (Y, X, Xtilde, C) values for 1,000 subjects and list
# of Xtilde values where 25 subjects have replicates. Xtilde values are
# affected by measurement error. True log-OR = 0.5, sigsq = 1, sigsq_m = 0.5.
data(dat_ndfa)
dat <- dat_ndfa$dat
reps <- dat_ndfa$reps

# Estimate log-OR for X and Y adjusted for C using true X values
# (unobservable truth).
fit.unobservable <- ndfa(
  y = dat$y,
  xtilde = dat$x,
  c = dat$c,
  merror = FALSE
)
fit.unobservable$estimates

# Estimate log-OR for X and Y adjusted for C using observed Xtilde values,
# ignoring measurement error.
fit.naive <- ndfa(
  y = dat$y,
  xtilde = dat$xtilde,
  c = dat$c,
  merror = FALSE
)
fit.naive$estimates

# Repeat, but accounting for measurement error.
fit.corrected <- ndfa(
  y = dat$y,
  xtilde = reps,
  c = dat$c,
  merror = TRUE
)
fit.corrected$estimates

# Same as previous, but allowing for non-constant odds ratio.
fit.nonconstant <- ndfa(
  y = dat$y,
  xtilde = reps,
  c = dat$c,
  constant_or = FALSE,
  merror = TRUE
)
fit.nonconstant$estimates

# Perform likelihood ratio test for H0: odds ratio is constant.
lrt <- ndfa(
  y = dat$y,
  xtilde = reps,
  c = dat$c,
  constant_or = NULL,
  merror = TRUE
)

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