lod_root2 {lodi} | R Documentation |
Single pollutant sqrt(2)
imputation.
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
lod_root2(formula, df, lod, type)
Arguments
formula |
A R formula in the form |
df |
A data.frame that contains the variables |
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
# 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)
[Package lodi version 0.9.2 Index]