MeasError: Create a Measurement Error Object

Description Usage Arguments Value Author(s) Examples

Description

This function creates a measurement error object, usually used in a regression where one wants to correct for the measurement error in the measured variable using a reference measure.

Usage

1
MeasError(test, reference)

Arguments

test

a vector containing error-prone measurements or a matrix with replicate error-prone measurements

reference

a vector containing reference measurements

Value

MeasError returns an object of class "MeasError".

An object of class MeasError is a data.frame and additionally has attributes input (the name of the test and reference variables) and call (the matched call).

Author(s)

Linda Nab, [email protected]

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
##measurement error in exposure
nobs <- 1e3
Z <- rnorm(nobs, 0, 1)
X <- Z + rnorm(nobs, 0, 1)
Y <- 0.5 * X + 2 * Z + rnorm(nobs, 0, 1)
W <- X + rnorm(nobs, 0, 0.5)
X <- ifelse(rbinom(nobs, 0, 0.9) == 1, NA, X)
data <- data.frame(Z, X, W, Y)
W2 <- X + rnorm(nobs, 0, 0.5)
data2 <- data.frame(Z, W, W2, Y)

MeasError(W, X)
MeasError(cbind(W, W2), NA)

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