如果我运行此代码:
fitstats <- function(f29,
method = "nonparboot") {
observed <- getY(f29@occ_df)
expected <- fitted(f29)
resids <- residuals(f29,
method = "nonparboot")
sse <- sum(resids^2,
na.rm = TRUE)
chisq <- sum((observed - expected)^2 / expected,
na.rm = TRUE)
freeTuke <- sum((sqrt(observed) - sqrt(expected))^2,
na.rm = TRUE)
out <- c(SSE = sse,
Chisq = chisq,
freemanTukey = freeTuke)
return(out)
}
pb <- parboot(f29,
fitstats,
nsim = 1000,
report = TRUE,
method = "nonparboot")
pb
第一部分 fitstats 运行没有错误,但 pb 部分告诉我这一点
error: Fehler in h(simpleError(msg, call)) :
Fehler bei der Auswertung des Argumentes 'object' bei der Methodenauswahl für Funktion 'getY': kein Slot des Namens "occ_df" für dieses Objekt der Klasse "unmarkedFitOccu"
英文翻译:
Error in h(simpleError(msg, call)) :
error in evaluation of the argument'object' at method selection for function 'getY': no slot named "occ_df" for this object of class "unmarkedFitOccu"
问题是,我已经定义了变量 occ_df,当我查看它时,它显示为 unmarkedFrameOccu 类的 s4 对象。我该如何解决这个错误?
感谢您提前提供的所有帮助。