mcerror: Monte Carlo Errors

View source: R/mcerror.R

mcerrorR Documentation

Monte Carlo Errors

Description

Calculate Monte Carlo errors for statistics calculated by combining results of multiply imputed datasets. Monte Carlo errors are defined as the standard deviation of the results across repeated runs of the same imputation procedure using the same data. White, Royston, and Wood (2011) suggest evaluating Monte Carlo error estimates not only for parameter estimates but also for other statistics, including p-values and confidence intervals, as well as multiple imputations statistics such as RVI and FMI.

Usage

mcerror(object, dfcom = NULL, rule = NULL, conf.int = FALSE, conf.level = 0.95)

## S3 method for class 'mimcerror'
print(x, ...)

## S3 method for class 'mimcerror'
summary(object, ...)

Arguments

object

An object of class mimcerror to summarise.

dfcom

A positive number representing the degrees of freedom in the complete-data analysis. Normally, this would be the number of independent observation minus the number of fitted parameters. The default (dfcom = NULL) extract this information in the following order: 1- The component residual.df returned by glance() if a glance() function is found, 2- The result of df.residual( applied to the first fitted model, and 3- 999999. In the last case, the warning Large sample assumed is printed. If the degrees of freedom is incorrect, specify the appropriate value manually.

rule

A string indicating the pooling rule. Currently supported are "rubin1987" (default, for missing data) and "reiter2003" (for synthetic data created from a complete data set).

conf.int

Whether Monte Carlo errors for model parameter confidence intervals are to be calculated. Defaults to FALSE.

conf.level

Confidence level for the confidence intervals, defaulting to 0.95.

x

An object of class mimcerror to print.

...

Additional arguments to be passed to print.data.frame().

Note

This function calculate and displays Monte Carlo errors for statistics calculated by the mice::pool() function or by the summary of it.

Examples

library(mice)
library(mice.mcerror)
data("mheart1s20.mice")
fit <- with(
  data = mheart1s20.mice,
  expr = glm(
    formula = attack ~ smokes + age + bmi + hsgrad + female,
    family = binomial(link = "logit")
  )
)

mce <- mcerror(fit)

mce

summary(mce)

ellessenne/mice.mcerror documentation built on May 5, 2022, 12:34 a.m.