1
$\begingroup$

I am trying to bootstrap a spatial autologistic regression model I've run. I get different coefficients than my original model, however I'm getting zero bias and zero standard error:

Call:
boot(data = SpatModelData, statistic = logit_test, R = 10000)


Bootstrap Statistics :
          original  bias    std. error
t1* -9.61446203999       0           0
t2*  0.00204855993       0           0
t3* -0.00006460087       0           0
t4*  0.44715200453       0           0
t5*  0.00006142740       0           0
t6*  0.00237036752       0           0
t7* -0.27383819088       0           0
t8*  3.74004003319       0           0

Can anyone explain this or help with code? I think it's something to do with my function statement based on what I read here (https://stackoverflow.com/questions/27595014/bootstrap-code-not-reporting-bias-or-standard-error).

Here is my code:

# read about bootstrapping
?boot

# load the bootstrap library
library(boot)  

# create the bootstrap function
logit_test <- function(d,indices) {d <- d[indices,]
fit <- glm(Skunk ~ EVI+ROADDIST+SPECIES_1+POP+PRECIP+SLOPE+AUTOCOV,data = SpatModelData, family = binomial("logit"))  
return(coef(fit))}

# run the bootstrapping
BootResults <-boot(data=SpatModelData,statistic=logit_test, R=10000)

#view the results
BootResults

Also when I look at the results of the bootstrapping, they're the same for all 10000 iterations

> BootResults$t
              [,1]       [,2]           [,3]     [,4]         [,5]        [,6]       [,7]    [,8]
    [1,] -9.614462 0.00204856 -0.00006460087 0.447152 0.0000614274 0.002370368 -0.2738382 3.74004
    [2,] -9.614462 0.00204856 -0.00006460087 0.447152 0.0000614274 0.002370368 -0.2738382 3.74004
    [3,] -9.614462 0.00204856 -0.00006460087 0.447152 0.0000614274 0.002370368 -0.2738382 3.74004
    [4,] -9.614462 0.00204856 -0.00006460087 0.447152 0.0000614274 0.002370368 -0.2738382 3.74004
    [5,] -9.614462 0.00204856 -0.00006460087 0.447152 0.0000614274 0.002370368 -0.2738382 3.74004

When I look at each of the individual columns of the boot object they are null

#view the results
BootResults$t3
> BootResults$t3
NULL

The "SpatModelData" is a data frame of point locations of the presence/absence of rabid animals along with environmental covariates like temperature, elevation, land cover, etc. I've cleaned the data so there are no missing values in each of these observations. The original spatial model (pre bootstrap) has 860 observations, 430 of which are where there are known positive animals, 430 of which are controls with pseudo-absence. That is I laid a hexagon grid across my study area, generated hexagon centroids, and randomly selected 430 of them to extract covariate raster values at each location.

$\endgroup$
1
$\begingroup$

The problem was in fact in the function part of my code. Specifically

# create the bootstrap function
logit_test <- function(d,indices) {d <- d[indices,]
fit <- glm(Skunk ~ EVI+ROADDIST+SPECIES_1+POP+PRECIP+SLOPE+AUTOCOV,data = SpatModelData, family = binomial("logit"))  
return(coef(fit))}

it should be

data=d 

instead of

data=SpatModelData

I assume because in my function I've created indices for a "d", but not for SpatModelData, so it was just running it over and over on the same data 10,000 times vs. resampling from d. I now get bias estimates:

Call:
boot(data = SpatModelData, statistic = logit_test, R = 10000)


Bootstrap Statistics :
          original             bias      std. error
t1* -9.61446203999 -0.248008516635512 1.45703631910
t2*  0.00204855993  0.000043011405963 0.00047026194
t3* -0.00006460087 -0.000000002739528 0.00002764687
t4*  0.44715200453  0.009214172887561 0.10177078517
t5*  0.00006142740  0.000041275524262 0.00011149587
t6*  0.00237036752  0.000095778509203 0.00115328327
t7* -0.27383819088 -0.008583652790119 0.06213761536
t8*  3.74004003319  0.045069546918851 0.51931663284
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.