Description Usage Arguments Note Examples
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.
1  | 
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.  | 
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.
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)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.