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.2894608  0.1805522 -1.0349632  2.7587522  0.4477729 -0.8378221
#>  [7] -0.6046099 -1.5570994  0.8712944  2.5041998  1.3756781  0.3678895
#> [13] -0.3241958  0.4560310 -1.2554598 -0.6648399  1.1078661 -0.0824445
#> [19] -0.6935148
# }