View source: R/residuals.scampr.R
residuals.scampr | R Documentation |
Extract Model Residuals for objects of class 'scampr' ### WIP ###
## S3 method for class 'scampr'
residuals(
object,
...,
type = c("raw", "inverse", "pearson"),
which.data = c("PO", "PA")
)
object |
a scampr model object |
... |
NA |
type |
As in residuals.ppm: A string indicating the type of residuals or weights to be used. Current options are "raw" for the raw residuals, "inverse" for the inverse-lambda residuals, and "pearson" for the Pearson residuals. |
which.data |
Optionally, a character string indicating which data to calculate residuals on. Only relevant to integrated data models, one of "PO" or "PA". |
a numeric vector, of length of the model data, containing the extracted residuals.
# Get the flora data for one of the species
dat_po <- flora$po$sp1
# obtain a sample of 10,000 quadrature points for the point process model
set.seed(1)
quad.pts <- flora$quad[sample(1:nrow(flora$quad), 10000, replace = F), ]
set.seed(NULL)
# Attach the quadrature points to the presence-only data
dat_po <- rbind.data.frame(dat_po, quad.pts)
# Point Process Model
m <- scampr(pres ~ MNT + D.Main, dat_po, include.sre = F)
# Get the residuals
res <- residuals(m)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.