[unmarked] Predict & Confidence Intervals

1,068 views
Skip to first unread message

Dan

unread,
May 7, 2012, 2:27:26 PM5/7/12
to unmarked
Hello,

I am predicting occupancy as a function of covariates and would like
to use a confidence interval other than 95% (apparently the default
value). Is there an easy way to incorporate this into the code below
for example:

# Expected occupancy over range of "woody"
newData2 <- data.frame(woody=seq(-1.6, 2.38, by=0.1))
E.psi <- predict(fm3, type="state", newdata=newData2, appendData=TRUE)
head(E.psi)

# Plot predictions with 95% CI
plot(Predicted ~ woody, E.psi, type="l", ylim=c(0,1),
xlab="woody vegetation (standardized)",
ylab="Expected occupancy probability")
lines(lower ~ woody, E.psi, type="l", col=gray(0.5))
lines(upper ~ woody, E.psi, type="l", col=gray(0.5))

Cheers,
Dan

Richard Chandler

unread,
May 7, 2012, 2:53:24 PM5/7/12
to unma...@googlegroups.com
Hi Dan,

For some reason, I forgot to add that argument to predict. I'll fix that. In the meantime, you could use linearComb instead of predict. You will need to create the design matrix yourself. Something like this should work:

X <- cbind(Intercept=1, woody=seq(-1.6, 2.38, by=0.1), habitat=1) # design matrix
lc <- linearComb(fm3, X, type="state")
lc <- backTransform(lc)
out <- data.frame(Predicted=coef(lc), SE=SE(lc), confint(lc, level=0.9))

Richard

_____________________________________
Richard Chandler, post-doc
USGS Patuxent Wildlife Research Center
301-497-5696



From: Dan <routhi...@gmail.com>
To: unmarked <unma...@googlegroups.com>
Date: 05/07/2012 02:27 PM
Subject: [unmarked] Predict & Confidence Intervals
Sent by: unma...@googlegroups.com


Dan

unread,
May 23, 2012, 4:16:59 PM5/23/12
to unmarked
Hi Richard,

I have managed to get this to work for single models, but I would like
to get different CI's for model averaged predictions.

When I use the example code you provided and change the model fm3 to
fms (fitList) I get an error - because linearComb is used for fitted
models only and not a fitList right?

Is there any way around this?

Cheers,
Dan

Richard Chandler

unread,
May 24, 2012, 3:40:16 PM5/24/12
to unma...@googlegroups.com
Hi Dan,

You will have to wait until the next version of unmarked is released (probably in the next month or two), or do the model averaging yourself after computing the predictions and SEs from each model with the code I posted earlier.

Richard
_____________________________________
Richard Chandler, post-doc
USGS Patuxent Wildlife Research Center
301-497-5696



From: Dan <routhi...@gmail.com>
To: unmarked <unma...@googlegroups.com>
Date: 05/23/2012 04:17 PM
Subject: [unmarked] Re: Predict & Confidence Intervals
Sent by: unma...@googlegroups.com

Dan

unread,
Jul 31, 2012, 9:14:00 AM7/31/12
to unma...@googlegroups.com
Hi Richard,

Thanks for including the 'level' argument in the predict function. I have been playing around with it and although it works for individual models, I cannot obtain different CI levels when model averaging as described in my earlier post. Just not sure if it is not possible or if I am doing something wrong.

Cheers,
Dan

Richard Chandler

unread,
Jul 31, 2012, 10:49:42 AM7/31/12
to unma...@googlegroups.com
Hi Dan,

Sorry, I will try to add that capacity to the next version.

Matt Giovanni

unread,
Jul 31, 2012, 11:34:20 AM7/31/12
to unma...@googlegroups.com
Dan, check out Marc Mazerolle's AICcmodavg package.  He has developed very handy and customizable functions specific to unmarked:

http://cran.r-project.org/web/packages/AICcmodavg/index.html

Matt
__________________________________________
Matt Giovanni, Ph.D. | Research Biologist
Director, American Kestrel Partnership
The Peregrine Fund
5668 West Flying Hawk Lane, Boise, ID 83709 USA
208.362.8279 office | 402.617.3764 mobile
Check out my research website
Conserving birds of prey worldwide
Reply all
Reply to author
Forward
0 new messages