lod_root2: Single pollutant 'sqrt(2)' imputation.

Description Usage Arguments Note Examples

View source: R/cca-r2.R

Description

lod_root2 is a helper function that performs single imputation with lod / sqrt(2), a common ad hoc approach used in single-pollutant modeling. The function can be used to compare with clmi.

Usage

1

Arguments

formula

A R formula in the form outcome ~ exposure + covariates.

df

A data.frame that contains the variables formula references.

lod

Name of the limit of detection variable.

type

The type of regression to perform. Acceptable options are linear and logistic.

Note

Depending on the transformation used, a "Complicated transformation" error may occur. For example, the transformation a * exposure will cause an error. In this case, define a transformation function as f <- function(exposure) a * exposure and use f in your formula. This technical limitation is unavoidable at the moment.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# load lodi's toy data
library(lodi)
data("toy_data")
lodi.out <- lod_root2(case_cntrl ~ poll + smoking + gender, toy_data, lod,
                        logistic)
# see the fit model
lodi.out$model

# we can log transform poll to make it normally distributed
lodi.out <- lod_root2(case_cntrl ~ log(poll) + smoking + gender, toy_data,
                        lod, logistic)
lodi.out$model

# transforming the exposure results in a new column being added to data,
# representing the transformed lod.
head(lodi.out$data)

# You can even define your own transformation functions and use them
f <- function(x) exp(sqrt(x))
lodi.out <- lod_root2(case_cntrl ~ f(poll) + smoking + gender, toy_data, lod,
                        logistic)
head(lodi.out$data)

umich-cphds/lodmi documentation built on Feb. 21, 2020, 6:10 p.m.