Search code examples
rlatticegoodness-of-fitunmarked-package

Why can I not do more than nsim=99 when doing a parametric bootstrap goodness of fit test?


This is my goodness of fit test:

(fm <- distsamp(~1 ~ndvi_avg, keyfun="hazard", umf))

# Function returning three fit-statistics.

fitstats <- function(fm) {
  
  observed <- getY(fm@data)
  
  expected <- fitted(fm)
  
  resids <- residuals(fm)
  
  sse <- sum(resids^2)
  
  chisq <- sum((observed - expected)^2 / expected)
  
  freeTuke <- sum((sqrt(observed) - sqrt(expected))^2)
  
  out <- c(SSE=sse, Chisq=chisq, freemanTukey=freeTuke)
  
  return(out)
  
}

(pb <- parboot(fm, fitstats, nsim=100, report=1))

I can do up to nsim=99, and then I try nsim=100 which results in the following:

> (pb <- parboot(fm, fitstats, nsim=100, report=1))
t0 = 103.385 540.1714 70.38591 
Running in parallel on 3 cores. Bootstrapped statistics not reported.

I wonder if this is a bug in the unmarked package?


Solution

  • Try parallel = FALSE inside parboot().

    Documentation: https://www.rdocumentation.org/packages/unmarked/versions/1.1.0/topics/parboot