# Data ---------------------------------------------------------------------
data("nas1982", package = "betaMC")
nas1982_missing <- mice::ampute(nas1982)$amp # data set with missing values
# Multiple Imputation
mi <- mice::mice(nas1982_missing, m = 5, seed = 42, print = FALSE)
# Fit Model in lm ----------------------------------------------------------
## Note that this does not deal with missing values.
## The fitted model (`object`) is updated with each imputed data
## within the `MCMI()` function.
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982_missing)
# Monte Carlo --------------------------------------------------------------
mc <- MCMI(
object,
mi = mi,
R = 100, # use a large value e.g., 20000L for actual research
seed = 0508
)
mc
# The `mc` object can be passed as the first argument
# to the following functions
# - BetaMC
# - DeltaRSqMC
# - DiffBetaMC
# - PCorMC
# - RSqMC
# - SCorMC
Run the code above in your browser using DataLab