residuals.slmfit {sptotal}R Documentation

Extract Model Residuals from an slmfit object.

Description

Extract Model Residuals from an slmfit object.

Usage

## S3 method for class 'slmfit'
residuals(object, type = "raw", cross.validation = FALSE, ...)

Arguments

object

a slmfit object generated from the slmfit() function.

type

residual type: "raw" (the default) or "normalized"

cross.validation

a logical (TRUE or FALSE) that indicates whether the residuals computed should be found using leave one out cross-validation. Set to FALSE by default.

...

further arguments passed to or from other methods.

Value

a vector of residuals, consisting of each observed response/density minus the estimated mean, or, in the case of cross-validation, the observed response/density minus the leave-one-out-cross-validation prediction.

Examples

data(exampledataset) ## load a toy data set
slmobj <- slmfit(formula = counts ~ pred1 + pred2, data = exampledataset,
xcoordcol = 'xcoords', ycoordcol = 'ycoords', areacol = 'areavar')
residuals(slmobj)
residuals(slmobj, cross.validation = TRUE)

[Package sptotal version 1.0.1 Index]