Lisa
Here is a very simple answer to your question, based upon the use of
dsm_var_gam
for estimating uncertainty from your
dsm
model. The following code is based around the example provided at
this case study website
Example spatial analysis of pantropical spotted dolphins.
|
I have omitted much of the code, leaving the fitting of a simple dsm
model to data and using
dsm_var_gam
for variance estimation. I encourage you to look at the
help
for the function dsm_var_gam
to learn the structure of the object produced by this function.
library(dsm)
load("mexdolphins-extra.rda")
data(mexdolphins)
library(rgdal)
library(maptools)
library(plyr)
proj4string(survey.area) <- CRS("+proj=longlat +datum=WGS84")
lcc_proj4 <- CRS("+proj=lcc +lat_1=20 +lat_2=60 +lat_0=40 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs ")
survey.area <- spTransform(survey.area, CRSobj=lcc_proj4)
survey.area <- data.frame(survey.area@polygons[[1]]@Polygons[[1]]@coords)
names(survey.area) <- c("x", "y")
library(Distance)
detfc.hr.null <- ds(distdata, max(distdata$distance), key="hr", adjustment=NULL)
dsm.xy.depth <- dsm(count~s(x,y,k=10) + s(depth,k=20), detfc.hr.null, segdata, obsdata, method="REML")
summary(dsm.xy.depth)
plot(dsm.xy.depth, select=2)
dsm.xy.depth.pred <- predict(dsm.xy.depth, preddata, preddata$area)
preddata.var <- split(preddata, 1:nrow(preddata))
dsm.xy.depth.var <- dsm_var_gam(dsm.xy.depth, pred.data=preddata.var,off.set=preddata$area)
summary(dsm.xy.depth.var)
cv.by.gridcell <- sqrt(dsm.xy.depth.var$pred.var)/dsm.xy.depth.pred
The final step produces CV values for all 1374 prediction grid cells in this project. I have not attached the spatial coordinates to these CV values. Those spatial coordinates are contained in the object
pred.polys
You can combine the two to create something I suspect you can export to ArcGIS. I suspected the main part of your question was how to compute the CV from the elements contained within an object created by
dsm_var_gam
. I hope this answers your question.