mefit: Fitting Measurement Error Model

Description Usage Arguments Value Author(s) Examples

Description

This function fits several measurement error models to model the relationship between the test measurement (error-prone measurement) and the reference measurement (true measurement) in a validation set.

Usage

1
2
mefit(MeasError, differential, model = "all", robust = FALSE,
  plot = TRUE)

Arguments

MeasError

object of class MeasError

differential

vector containing the differential measurement error variable

model

optional character string or vector of character strings indicating the assumed measurement error model: "all" (default), "cme" (classical measurement error), "sme1" (systematic measurement error with zero intercept), "sme2" (systematic measurement errror with non-zero intercept) and "dme" (differential measurement error).

robust

boolean indicating whether robust standard errors need to be calculated, the "HC3" robust standard errors from vcovHC are used for the heteroskedasticity-consistent estimation of the covariance matrix of the coefficient estimates.

plot

boolean indicating whether one wants plots of the residuals (one plot for each tested model)

Value

mefit returns an object of class "mefit".

An object of class mefit is a list containing, depending on the models tested for, the following components:

cme

a list containing the coefficients, sigma, df and model of the classical measurement error model

sme1

a list containing the coefficients, sigma, df and model of the systematic measurement error model with zero intercept

sme2

a list containing the coefficients, sigma, df and model of the systematic measurement error model with non-zero intercept

dme

a list containing the coefficients, sigma, df and model of the differential measurement error model

lrtest1

a list containing the likelihood ratio test of, depending on which models are tested, cme vs sme1 vs sme2; cme vs sme1; cme vs sme2; sme1 vs sme2

lrtest2

a list containing the likelihood ratio test of, depending on whether one tests for differential measurement error, sme2 vs dme

Author(s)

Linda Nab, [email protected]

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
##measurement error in endpoint
X <- c(rep(0, 50), rep(1, 50))
Y <- X + rnorm(100, 0, 1)
Vcme <- Y + rnorm(100, 0, 3) #classical measurement error (cme)
Vsme <- 1 + 2*Y + rnorm(100, 0, 3) #systematic measurement error (sme)
Vdme <- 2 + 2*X + 3*Y + 2*X*Y + rnorm(10, 0, 3*(1-X) + 2*X) #systematic differential measurement error (dme)

##measurement error in exposure
X <- rnorm(100, 0, 1)
Y <- 1.5*X + rnorm(100, 0, 0.5)
W1 <- X + rnorm(100, 0, 0.5)
W2 <- X + rnorm(100, 0, 0.5)

fit1 <- mefit(MeasError(Vcme, Y), plot = T)
fit2 <- mefit(MeasError(Vsme, Y), plot = T)
fit3 <- mefit(MeasError(Vdme, Y), X, robust = T, plot = T)
fit4 <- mefit(MeasError(W1, X), model = "all")
#fit5 <- mefit(MeasError(cbind(W1, W2), NA)) #not yet supported

LindaNab/mecor documentation built on June 13, 2019, 2:18 a.m.