Dear all,
How does one compute the confidence intervals using predict() and occuMS()?
I fitted a model using occuMS() and then used predict() to calculaze predicted values and their confidence intervals on the probability scale. The problem is that some upper limits of the CI were greater than 1. What’s wrong?
The code is shown below.
Thanks for your help.
Best wishes, Beni
###
library(unmarked)
y.data = matrix(
c(1,0,NA,NA,
0,2,2,2,
1,0,0,0,
1,1,1,0,
0,1,1,1,
0,1,1,1,
1,2,0,0,
1,1,2,0,
1,1,2,0,
0,0,0,0,
1,1,2,0,
1,2,2,0,
1,1,2,NA,
0,1,0,2,
1,2,0,0,
1,1,1,0,
0,0,0,0,
1,1,1,0,
1,1,2,0,
0,1,2,0,
1,1,2,0,
1,1,1,0,
1,1,2,0,
1,1,2,NA,
1,1,0,0,
1,1,2,0,
1,1,1,0,
0,0,0,0,
0,0,0,0,
1,1,2,2,
1,1,2,2,
1,2,2,2,
1,2,2,2,
1,2,0,0,
0,0,0,NA,
0,0,0,0,
1,0,0,0,
1,1,1,0),
nrow=38, ncol=4, byrow=T)
area = c(2.16743982, 3.22957599,-0.7722639,0.6139139,-0.88246398,-0.38416787,-0.90461981,-0.24423656,1.22692548,-0.43040444,-0.66019999,-0.85714662,-0.25446389,-0.92644011,-0.59230537,0.61632236,-0.08612846,-0.02361069,0.22154757,-0.64852993,-1.03235202,-0.74222298,-0.87926839,0.25986109,-0.32464664,-0.46302077,-0.72726601,2.74550461,-0.01893848,0.28137424,0.19222363,-0.04268901,1.41030859,0.89018083,-0.24518774,-0.09871367,-0.35404597, -0.20002436)
umf = unmarkedFrameOccuMS(y = y.data, siteCovs = data.frame(area = area))
detformulas <- c('~1','~1','~1')
stateformulas <- c('~ area','~1')
(m1 = occuMS(detformulas, stateformulas, data = umf, parameterization='condbinom'))
newdata = data.frame(area = area)
(p1 = predict(m1, newdata=newdata, type='psi'))
max(p1$psi$upper) > 1
print(max(p1$psi$upper))