Skip to contents

Compute model residuals from a mars object with optional scaling.

Usage

# S3 method for class 'mars'
residuals(
  object,
  type = c("raw", "pearson", "studentized", "whitened", "standardized"),
  ...
)

Arguments

object

A fitted mars object.

type

Residual type. One of "raw", "pearson", "studentized", "whitened", or "standardized".

...

Not used.

Value

A numeric vector of residuals.

Examples

# \donttest{
fit <- mars(
  data = teacher_expectancy,
  studyID = "study",
  effectID = NULL,
  sample_size = NULL,
  formula = yi ~ 1,
  variance = "vi",
  varcov_type = "univariate",
  structure = "univariate"
)
residuals(fit, type = "pearson")
#>  [1] -0.28946078  0.18055190 -1.03496293  2.75875178  0.44777270 -0.83782168
#>  [7] -0.60460966 -1.55709909  0.87129387  2.50419908  1.37567775  0.36788925
#> [13] -0.32419581  0.45603076 -1.25545943 -0.66483973  1.10786534 -0.08244465
#> [19] -0.69351470
# }