David L Miller
Now we are dangerous.
(Getting a little fast-and-loose with the mathematics)
From previous lectures we know:
dsm
to do thisdsm.var.gam
dsm.var.prop
count
models (more or less)Using dsm.var.gam
dsm_tw_var_ind <- dsm.var.gam(dsm_all_tw_rm, predgrid, off.set=predgrid$off.set)
summary(dsm_tw_var_ind)
Summary of uncertainty in a density surface model calculated
analytically for GAM, with delta method
Approximate asymptotic confidence interval:
5% Mean 95%
1538.968 2491.864 4034.773
(Using delta method)
Point estimate : 2491.864
Standard error : 331.1575
Coefficient of variation : 0.2496
Using dsm.var.prop
dsm_tw_var <- dsm.var.prop(dsm_all_tw_rm, predgrid, off.set=predgrid$off.set)
summary(dsm_tw_var)
Summary of uncertainty in a density surface model calculated
by variance propagation.
Quantiles of differences between fitted model and variance model
Min. 1st Qu. Median Mean 3rd Qu. Max.
-4.665e-04 -3.535e-05 -4.358e-06 -3.991e-06 2.095e-06 1.232e-03
Approximate asymptotic confidence interval:
5% Mean 95%
1460.721 2491.914 4251.075
(Using delta method)
Point estimate : 2491.914
Standard error : 691.8776
Coefficient of variation : 0.2776
dsm.var.*
thinks predgrid
is one “region”split()
)width
and height
of cells for plottingpredgrid$width <- predgrid$height <- 10*1000
predgrid_split <- split(predgrid, 1:nrow(predgrid))
head(predgrid_split,3)
$`1`
x y Depth SST NPP off.set height width
126 547984.6 788254 153.5983 9.04917 1462.521 1e+08 10000 10000
$`2`
x y Depth SST NPP off.set height width
127 557984.6 788254 552.3107 9.413981 1465.41 1e+08 10000 10000
$`3`
x y Depth SST NPP off.set height width
258 527984.6 778254 96.81992 9.699239 1429.432 1e+08 10000 10000
dsm_tw_var_map <- dsm.var.prop(dsm_all_tw_rm, predgrid_split,
off.set=predgrid$off.set)
p <- plot(dsm_tw_var_map, observations=FALSE, plot=FALSE) +
coord_equal() +
scale_fill_viridis()
print(p)
cut()
in R to make categorical variable
c(seq(0,1, len=100), 2:4, Inf)
or somesuch