Rather than use a bootstrap to calculate the variance in a `dsm`

model, use the clever variance propogation trick from Williams et al. (2011).

1 2 | ```
dsm.var.prop(dsm.obj, pred.data, off.set, seglen.varname = "Effort",
type.pred = "response")
``` |

`dsm.obj` |
an object returned from running |

`pred.data` |
either: a single prediction grid or list of prediction grids. Each grid should be a |

`off.set` |
a a vector or list of vectors with as many elements as there are in |

`seglen.varname` |
name for the column which holds the segment length (default value |

`type.pred` |
should the predictions be on the "response" or "link" scale? (default |

The idea is to refit the spatial model but including the Hessian of the offset as an extra term. Variance estimates using this new model can then be used to calculate the variance of abundance estimates which incorporate detection function uncertainty. Further mathematical details are given in the paper in the references below.

Many prediction grids can be supplied by supplying a list of `data.frame`

s to the function.

Note that this routine is only useful if a detection function has been used in the DSM.

Based on (much more general) code from Mark Bravington and Sharon Hedley.

a list with elements

`model` | the fitted model object |

`pred.var` | variance of each region given
in `pred.data` . |

`bootstrap` | logical, always `FALSE` |

`pred.data` | as above |

`off.set` | as above |

`model` | the fitted model with the extra term |

`dsm.object` | the original model, as above |

`model.check` | simple check of subtracting the coefficients of the two models to see if there is a large difference |

`deriv` | numerically calculated Hessian of the offset |

Mark V. Bravington, Sharon L. Hedley. Bugs added by David L. Miller.

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), 526-535.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ```
## Not run:
library(Distance)
library(dsm)
# load the Gulf of Mexico dolphin data (see ?mexdolphins)
data(mexdolphins)
attach(mexdolphins)
# fit a detection function and look at the summary
hr.model <- ds(distdata, max(distdata$distance),
key = "hr", adjustment = NULL)
summary(hr.model)
# fit a simple smooth of x and y
mod1 <- dsm(N~s(x,y), hr.model, segdata, obsdata)
# Calculate the variance
mod1.var <- dsm.var.prop(mod1, preddata, off.set=preddata$area)
# this will give a summary over the whole area in mexdolphins$preddata
# detach the data
detach("mexdolphins")
## End(Not run)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.