[unmarked] Predict using a colext object

231 views
Skip to first unread message

Benjamin Zuckerberg

unread,
May 13, 2010, 11:40:10 AM5/13/10
to unma...@googlegroups.com

Greetings Ian and Richard,

 

I am just wondering if there are any plans to developing a predict() function for use with colext objects in future versions of unmarked?  Thank you.

 

Kind regards,

Ben

 

rcha...@nrc.umass.edu

unread,
May 13, 2010, 12:21:06 PM5/13/10
to unma...@googlegroups.com
I will put that on the to-do list. In the meantime, note that predict
is basically just a convenience wrapper for linearComb. See
?linearComb for examples of getting predictions without predict. And
continuing with the colext example, you can do something like this:

# Logit-scale estimate of colonization prob in year 3
lc <- linearComb(fm.yearly, c(1,0,1,0,0,0), type="col")

# Back-transform it and get confidence interval

confint(backTransform(lc))


Richard
UMass Amherst
Natural Resources Conservation
nrc.umass.edu/index.php/people/graduate-students/chandler-richard/

Benjamin Zuckerberg

unread,
May 13, 2010, 12:41:16 PM5/13/10
to unma...@googlegroups.com
Hi Richard,

Thank you for the response. Yes, I was starting to look at linearComb as an alternative. I just wanted to check on something, however. When I tried the code below using example(colext). I receive the following error:

> lc <- linearComb(fm.yearly, c(1,0,1,0,0,0), type="col")
Error in .local(obj, coefficients, ...) :
no slot of name "covMatBS" for this object of class "unmarkedEstimate"

Is there something I am doing wrong for this example? Thank you.

rcha...@nrc.umass.edu

unread,
May 13, 2010, 1:37:25 PM5/13/10
to unma...@googlegroups.com
Hi Ben,

It works fine for me. What version of unmarked are you using? It
probably needs to be unmarked_0.8-6. To see, type:

sessionInfo()

In the new version you should see a slot named 'covMatBS' when you type:

slotNames(fm.yearly)

If that isn't the problem, type: traceback() after the error and let
me know what you get.

Benjamin Zuckerberg

unread,
May 13, 2010, 2:16:47 PM5/13/10
to unma...@googlegroups.com
Hi Richard,

Yep. That did the trick. Just need to update the package. Thank you.
By the way, I have not played around with the colext function much. But, is there a way of estimating conditional extinction probabilities between time periods? By conditional, I mean making it conditional on the species actually occupying a site during the first time period. Thank you.

Ben

rcha...@nrc.umass.edu

unread,
May 13, 2010, 2:36:54 PM5/13/10
to unma...@googlegroups.com
The colonization, extinction and detection probabilities are all
conditional. So, the example below gives you the probability of a site
unoccupied in year 3 being colonized in year 4. Colonization rate is 0
for occupied sites. I have to get back to writing my dissertation, but
someone else might keep this thread going if you want.

Benjamin Zuckerberg

unread,
May 14, 2010, 9:03:05 AM5/14/10
to unma...@googlegroups.com
Richard,

Very good. Thank you for that input. Good luck with the dissertation writing!

rcha...@eco.umass.edu

unread,
Aug 4, 2010, 7:15:15 AM8/4/10
to Giancarlo Sadoti, unma...@googlegroups.com
Hi Giancarlo,

The two relevant help pages are:

help("unmarkedFit-class")
help(linearComb)

They could use some work, but in there you will see that there is a
_names_ method that returns the names of the parameter types. So:

> names(fm.yearly)
[1] "psi" "col" "ext" "det"

After you decide which type of prediction you want, you need to give
linearComb specific covariate values (2nd argument).

lc <- linearComb(fm.yearly, c(1,0,1,0,0,0), type="ext") # is equivalent to:
lc <- linearComb(fm.yearly, coefficients=c(Int=1, year2=0, year3=1,
year4=0, year5=0, year6=0), type="ext")

Note that coefficients can be a properly formatted design matrix too.
The only advantage of the _predict_ method is that it creates the
design matrix for you. Hopefully this will be part of the next
release...sometime in the Fall maybe.


Richard

Quoting Giancarlo Sadoti <gcsa...@gmail.com>:

> Hi Richard and Ian,
>
> Your reply to Ben helps me understand things, but can you enlighten me
> a bit further on the syntax for using linearcomb()?
>
> e.g, lc <- linearComb(fm.yearly, c(1,0,1,0,0,0), type="col")
>
> I've used predict() to get occupancy probabilities from occu models
> (thanks for including this).
>
> I have a two season design and would like to estimate probabilities of
> both colonization and extirpation. (e.g., is type='removal' for
> extirpation?)
>
> Thanks for all you've done with this package. It has saved me time
> beyond measure!
>
> Giancarlo


>
>
> On May 13, 12:21 pm, rchand...@nrc.umass.edu wrote:
>> I will put that on the to-do list. In the meantime, note that predict  
>> is basically just a convenience wrapper for linearComb. See  
>> ?linearComb for examples of getting predictions without predict. And  
>> continuing with the colext example, you can do something like this:
>>
>> # Logit-scale estimate of colonization prob in year 3
>> lc <- linearComb(fm.yearly, c(1,0,1,0,0,0), type="col")
>>
>> # Back-transform it and get confidence interval
>>
>> confint(backTransform(lc))
>>
>> Richard
>

--
Richard Chandler

Giancarlo Sadoti

unread,
Aug 4, 2010, 12:34:40 PM8/4/10
to unmarked
Thanks a ton! That clears things up for me.

Giancarlo

Marina Xavier

unread,
Apr 11, 2014, 10:56:25 AM4/11/14
to unma...@googlegroups.com
Hi everyone.
I am interested in get the confidence interval of "psi" in colext. Is it possible at the same way as you discussing for the others parameters?
I tried and didn´t work.

nd <- data.frame(year=c('2009','2010','2013'))
E.psi <- predict(m51, type='psi', newdata=nd) 
Error in eval(expr, envir, enclos) : object 'B' not found 
B is one of the m51 model

Marina

Kery Marc

unread,
Apr 13, 2014, 2:58:51 AM4/13/14
to unma...@googlegroups.com
Dear Marina,

you can do predictions only for primary structural parameters of the model (I believe). The vector "psi" is such a parameter only in the first year, after that, the psi's are functions of other parameters (of psi in the first year and all the extinction and colonisation params leading up to a year). So if you want to get 95% CIs for psi in the 2 until the last year, you have to use the bootstrap.

Kind regards  --  Marc




From: unma...@googlegroups.com [unma...@googlegroups.com] on behalf of Marina Xavier [xavier...@gmail.com]
Sent: 11 April 2014 16:56
To: unma...@googlegroups.com
Subject: [unmarked] Re: Predict using a colext object

--
You received this message because you are subscribed to the Google Groups "unmarked" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unmarked+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages