Hello everyone,
I'm trying to set the
function for finite-sample number and proportion of occupied sites
fs.fn <- function(fm) {
Nocc <- sum(ranef(fm)@post[,2,])
psi.fs <- Nocc / nrow(fm@data@y)
out <- c(Nocc = Nocc, psi.fs = psi.fs)
return(out)
}
when I get to the stage:
fs.hat <- fs.fn(mod29)
PS: mod29 = occu(formula = ~temp + humi ~ land_5000m.enn, data = ufo)
The following error appears:
"Error in UseMethod("ranef") :
method not applicable for 'ranef' applied to a class object "c('unmarkedFitOccu', 'unmarkedFit')"
Any suggestions for dealing with this issue?