getPearsonResiduals: Get Pearson residuals

getPearsonResidualsR Documentation

Get Pearson residuals

Description

Wrapper to get the Pearson residuals of a fitted model.

Usage

getPearsonResiduals(object, ...)

## Default S3 method:
getPearsonResiduals(object, ...)

## S3 method for class 'gam'
getPearsonResiduals(object, ...)

Arguments

object

a fitted model.

...

additional parameters to be passed on, usually to the residual function of the respective model class.

Details

The purpose of this wrapper is to extract the Pearson residuals of a fitted model.

This needed to be adopted because for some reason, mgcv uses the argument "scaled.pearson" for what most packags define as "pearson". See comments in ?residuals.gam.

Author(s)

Florian Hartig

See Also

getObservedResponse, getSimulations, getRefit, getFixedEffects, getFitted

Examples

testData = createData(sampleSize = 400, family = gaussian())

fittedModel <- lm(observedResponse ~ Environment1 , data = testData)

# response that was used to fit the model
getObservedResponse(fittedModel)

# predictions of the model for these points
getFitted(fittedModel)

# extract simulations from the model as matrix
getSimulations(fittedModel, nsim = 2)

# extract simulations from the model for refit (often requires different structure)
x = getSimulations(fittedModel, nsim = 2, type = "refit")

getRefit(fittedModel, x[[1]])

getRefit(fittedModel, getObservedResponse(fittedModel))

DHARMa documentation built on Oct. 18, 2024, 5:09 p.m.