normUniImp | R Documentation |
Performs multiple imputation of a single continuous variable using a normal
linear regression model. The covariates in the imputation model must be fully
observed. By default normUniImp
imputes every dataset using the
maximum likelihood estimates of the imputation model parameters, which here
coincides with the OLS estimates, referred to as maximum likelihood multiple
imputation by von Hippel and Bartlett (2021). If pd=TRUE
is specified, it instead
performs posterior draw Bayesian imputation.
normUniImp(obsData, impFormula, M = 5, pd = FALSE)
obsData |
The data frame to be imputed. |
impFormula |
The linear model formula. |
M |
Number of imputations to generate. |
pd |
Specify whether to use posterior draws ( |
Imputed datasets can be analysed using withinBetween
,
scoreBased
, or for example the
bootImpute package.
A list of imputed datasets, or if M=1
, just the imputed data frame.
von Hippel P.T. and Bartlett J.W. Maximum likelihood multiple imputation: faster, more efficient imputation without posterior draws. Statistical Science 2021; 36(3) 400-420 \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1214/20-STS793")}.
#simulate a dataset with one partially observed (conditionally) normal variable
set.seed(1234)
n <- 100
x <- rnorm(n)
y <- x+rnorm(n)
x[runif(n)<0.25] <- NA
temp <- data.frame(x=x,y=y)
#impute using normImp
imps <- normUniImp(temp, y~x, M=10, pd=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.