Learn R Programming

dsm (version 2.3.3)

obs_exp: Observed versus expected diagnostics for fitted DSMs

Description

Given a covariate, calculate the observed and expected counts for each unique value of the covariate. This can be a useful goodness of fit check for DSMs.

Usage

obs_exp(model, covar, cut = NULL)

Value

data.frame with values of observed and expected counts.

Arguments

model

a fitted dsm model object

covar

covariate to aggregate by (character)

cut

vector of cut points to aggregate at. If not supplied, the unique values of covar are used.

Author

David L Miller, on the suggestion of Mark Bravington.

Details

One strategy for model checking is to calculate observed and expected counts at different aggregations of the variable. If these match well then the model fit is good.

Examples

Run this code
if (FALSE) {
library(Distance)
library(dsm)

# example with the Gulf of Mexico dolphin data
data(mexdolphins)
hr.model <- ds(distdata, truncation=6000,
               key = "hr", adjustment = NULL)
mod1 <- dsm(count~s(x,y), hr.model, segdata, obsdata)
}

Run the code above in your browser using DataLab