Learn R Programming

dsm (version 2.3.3)

dsm_var_gam: Prediction variance estimation assuming independence

Description

If one is willing to assume the the detection function and spatial model are independent, this function will produce estimates of variance of predictions of abundance, using the result that squared coefficients of variation will add.

Usage

dsm_var_gam(
  dsm.obj,
  pred.data,
  off.set,
  seglen.varname = "Effort",
  type.pred = "response"
)

Value

a list with elements

  • model the fitted model object

  • pred.var variance of the regions given in pred.data.

  • bootstrap logical, always FALSE

  • model the fitted model with the extra term

  • dsm.object the original model (dsm.obj above)

Arguments

dsm.obj

a model object fitted by dsm.

pred.data

either: a single prediction grid or list of prediction grids. Each grid should be a data.frame with the same columns as the original data.

off.set

a a vector or list of vectors with as many elements as there are in pred.data. Each vector is as long as the number of rows in the corresponding element of pred.data. These give the area associated with each prediction cell. If a single number is supplied it will be replicated for the length of pred.data.

seglen.varname

name for the column which holds the segment length (default value "Effort").

type.pred

should the predictions be on the "response" or "link" scale? (default "response").

Author

David L. Miller

Examples

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

 # load the Gulf of Mexico dolphin data (see ?mexdolphins)
 data(mexdolphins)

 # fit a detection function and look at the summary
 hr.model <- ds(distdata, truncation=6000,
                key = "hr", adjustment = NULL)
 summary(hr.model)

 # fit a simple smooth of x and y
 mod1 <- dsm(count~s(x, y), hr.model, segdata, obsdata)

 # Calculate the variance
 # this will give a summary over the whole area in mexdolphins$preddata
 mod1.var <- dsm_var_gam(mod1, preddata, off.set=preddata$area)
}

Run the code above in your browser using DataLab