Learn R Programming

DSSP (version 0.1.1)

residuals.dsspMod: Get residuals from dsspMod model

Description

Get residuals from dsspMod model

Usage

# S3 method for dsspMod
residuals(object, newdata, robust = TRUE, ...)

Value

vector containing residuals with same length as rows in data used.

Arguments

object

an object of class dsspMod

newdata

a data frame for which to estimate residuals.

robust

whether or not to use median (rather than mean) of posterior density to as estimate calculate residuals.

...

additional arguments which are ignored.

Examples

Run this code
library(sp)
library(gstat)
data(meuse.all)
coordinates(meuse.all) <- ~ x + y

f <- function(x) -x ## log-prior for exponential distribution for the smoothing parameter

## Draw 100 samples from the posterior of eta given the data y.
OUTPUT <- DSSP(
  formula = log(zinc) ~ 1, data = meuse.all, N = 100,
  pars = c(0.001, 0.001), log_prior = f
)
residuals(OUTPUT)

Run the code above in your browser using DataLab