residuals.mipai: Calculate the Residuals for Predictions

Description Usage Arguments Value Examples

View source: R/methods.R

Description

Calculate the Residuals for Predictions

Usage

1
2
3
## S3 method for class 'mipai'
residuals(object, type = c("MeanAbs", "MedianAbs",
  "RootMeanSq", "RootMedianSq"), summarize = TRUE, boot = TRUE, ...)

Arguments

object

an mipai or mibootpai class object returned from mi_lm_pai_cvboot

type

A character string indicating the type of residuals to be calculated. Currents mean or median of the absolute or root squared values. Only applies when summarize is FALSE.

summarize

Logical whether or not to summarize values for individuals across imputations or leave as a matrix of residuals. Defaults to TRUE.

boot

Not currently used.

dots

Additional arguments to pass down. Not currently used.

Value

A vector of residuals for each person or matrix across the multiple imputations.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
# builtin dataset with 32 cases
dat <- mtcars
dat$cyl <- factor(dat$cyl)

m <- mi_lm_pai_cvboot(~ cyl + am * (mpg + hp + drat + wt),
  "disp", "am", list(dat, dat),
  nboot = 50, holdouts = "10", cores = 2)

residuals(m, "RootMeanSq")

## End(Not run)

JWiley/pai documentation built on May 7, 2019, 10:15 a.m.