Learn R Programming

SSN (version 1.1.8)

residuals.glmssn: Compute Model Residuals for glmssn Objects

Description

residuals.glmssn is a generic function that has been modified for glmssn objects. It produces residuals from glmssn spatial models.

Usage

"residuals"(object, cross.validation=FALSE, ...)

Arguments

object
an object of class glmssn
cross.validation
logical value indicating whether leave-one-out cross-validation residuals will be computed. The default is FALSE. Setting cross.validation to TRUE may increase processing times for large datasets.
...
Other arguments

Value

The returned object is of class influenceSSN-class. It similar to a glmssn-classobject; the main difference is that additional columns (described in the details section) have been added to the observed points data.frame.

Details

When using residual(x) on a glmssn object, the data for which the model was fit is contained in the obspoints slot @SSNPoints@point.data. This data frame contains the response variable for the model, so it is appended with the following columns,

Examples

Run this code

	library(SSN)
	data(modelFits)
	#make sure fitSp has the correct path, will vary for each users installation
	fitSp$ssn.object@path <- system.file("lsndata/MiddleFork04.ssn", package = "SSN")
	names(fitSp)
	names(fitSp$ssn.object)

  resids <- residuals(fitSp)
  class(resids)
  names(resids)
  plot(resids)
  hist(resids, xlab = "Raw Residuals")
  qqnorm(resids)

  resids.df <- getSSNdata.frame(resids)
  plot(resids.df[,"_resid_"], ylab = "Raw Residuals")

Run the code above in your browser using DataLab