dsm_varprop {dsm}  R Documentation 
Variance propagation for density surface models
Description
Calculate the uncertainty in predictions from a fitted DSM, including uncertainty from the detection function.
Usage
dsm_varprop(
model,
newdata = NULL,
trace = FALSE,
var.type = "Vp",
var_type = NULL
)
Arguments
model 
a fitted 
newdata 
the prediction grid. Set to 
trace 
for debugging, see how the scale parameter estimation is going. 
var.type 
which variancecovariance matrix should be used ( 
var_type 
deprecated, use 
Details
When we make predictions from a spatial model, we also want to know the uncertainty about that abundance estimate. Since density surface models are 2 (or more) stage models, we need to incorporate the uncertainty from the earlier stages (i.e. the detection function) into our "final" uncertainty estimate.
This function will refit the spatial model but include the Hessian of the offset as an extra term. Variance estimates using this new model can then be used to calculate the variance of predicted abundance estimates which incorporate detection function uncertainty. Importantly this requires that if the detection function has covariates, then these do not vary within a segment (so, for example covariates like sex cannot be used).
For more information on how to construct the prediction grid data.frame
,
newdata
, see predict.dsm
.
This routine is only useful if a detection function with covariates has been used in the DSM.
Note that we can use var.type="Vc"
here (see gamObject
), which is the
variancecovariance matrix for the spatial model, corrected for smoothing
parameter uncertainty. See Wood, Pya & S\"afken (2016) for more
information.
Models with fixed scale parameters (e.g., negative binomial) do not require an extra round of optimisation.
Value
a list
with elements:

old_model
fitted model supplied to the function asmodel

refit
refitted model object, with extra term 
pred
point estimates of predictions atnewdata

var
total variance calculated over all ofnewdata

ses
standard error for each prediction cell innewdata
ifnewdata=NULL
then the last three entries areNA
.
Diagnostics
The summary output from the function includes a simply diagnostic that shows
the average probability of detection from the "original" fitted model (the
model supplied to this function; column Fitted.model
) and the probability
of detection from the refitted model (used for variance propagation; column
Refitted.model
) along with the standard error of the probability of
detection from the fitted model (Fitted.model.se
), at the unique values of
any factor covariates used in the detection function (for continuous
covariates the 5%, 50% and 95% quantiles are shown). If there are large
differences between the probabilities of detection then there are
potentially problems with the fitted model, the variance propagation or
both. This can be because the fitted model does not account for enough of
the variability in the data and in refitting the variance model accounts for
this in the random effect.
Author(s)
David L. Miller, based on code from Mark V. Bravington and Sharon L. Hedley.
References
Bravington, M. V., Miller, D. L., & Hedley, S. L. (2021). Variance Propagation for Density Surface Models. Journal of Agricultural, Biological and Environmental Statistics. https://doi.org/10.1007/s13253021004382
Williams, R., Hedley, S.L., Branch, T.A., Bravington, M.V., Zerbini, A.N. and Findlay, K.P. (2011). Chilean Blue Whales as a Case Study to Illustrate Methods to Estimate Abundance and Evaluate Conservation Status of Rare Species. Conservation Biology 25(3), 526535.
Wood, S.N., Pya, N. and S\"afken, B. (2016) Smoothing parameter and model selection for general smooth models. Journal of the American Statistical Association, 145.