Page 1 of 1

Comparing different parameterizations of RDOccupancy

PostPosted: Wed Sep 21, 2011 2:39 pm
by ekalies
Hi-

I have successfully used an adaptation of the help(RDOccupancy) code to run multi-season occupancy models, but this code forces you to run all your models using the same parameterization (be it RDOccupPE or whatever). Is there a way to run/compare models that use different parameterizations? My attempts failed. I'm trying to do something similar to Table 7.5 in Occupancy Estimation and Modeling and test for Markovian changes.

On that note- is there a way to run the parameterzation in RMark where epsilon = 1-gamma (as provided in PRESENCE)?

Thanks, liz

Re: Comparing different parameterizations of RDOccupancy

PostPosted: Wed Sep 21, 2011 3:07 pm
by bacollier
ekalies wrote:Hi-

I have successfully used an adaptation of the help(RDOccupancy) code to run multi-season occupancy models, but this code forces you to run all your models using the same parameterization (be it RDOccupPE or whatever). Is there a way to run/compare models that use different parameterizations? My attempts failed. I'm trying to do something similar to Table 7.5 in Occupancy Estimation and Modeling and test for Markovian changes.


I don't think you can do within run 'change data type' via RMark like you can using the pull down MARK at this time (I suppose you might be able to do it in Presence, but I have not looked). From the table it looks like they just stacked the models ranked by AIC and I can't tell if it was some sneaky DM manipulation or if they just ran each model separately.

On that note- is there a way to run the parameterzation in RMark where epsilon = 1-gamma (as provided in PRESENCE)?

Thanks, liz


Yes, see ?RDOccupancy, there is a simple example of epsilon=1-gamma Jeff included at the top that uses 'share' (you need to have most recent version of RMark to see it I think, I am using 2.0.8 ). I am re-writing the help file now and will detail that a bit more, but I am not done with it yet.

Bret

Re: Comparing different parameterizations of RDOccupancy

PostPosted: Wed Sep 21, 2011 6:29 pm
by darryl
bacollier wrote: I can't tell if it was some sneaky DM manipulation or if they just ran each model separately.

I prefer to think of it as 'creative' use of the design matrix rather than 'sneaky' :-)

That analysis was conducted in PRESENCE where you have the option of specifying the parameterization you want to use for each model fit to the data. Sorry, can't help you with how to do that in RMark.

Re: Comparing different parameterizations of RDOccupancy

PostPosted: Thu Sep 22, 2011 10:45 am
by ekalies
Thanks Bret and Darryl. I can definitely do it in PRESENCE but will give it one more go in R. One more question- Bret, how do us commoners get RMark 2.0.8? I downloaded the latest R and the latest RMark and got 2.0.7. Perhaps as a result, I don't think I am getting the ?RDOccupancy updated content you mentioned. If you don't mind posting the code you mentioned for the epsilon=1-gamma parameterization (or the direct link to the help file), that would be all I need. Thanks again- liz

Re: Comparing different parameterizations of RDOccupancy

PostPosted: Thu Sep 22, 2011 11:18 am
by bacollier
ekalies wrote:Thanks Bret and Darryl. I can definitely do it in PRESENCE but will give it one more go in R.


Anytime. Darryl, thanks for the heads up on Presence allowing for shifts in model types, good to know.

One more question- Bret, how do us commoners get RMark 2.0.8? I downloaded the latest R and the latest RMark and got 2.0.7. Perhaps as a result, I don't think I am getting the ?RDOccupancy updated content you mentioned.


Jeff has posted the most recent (beta) version of 2.0.8 on his github site-he posted the release to this board on 31 August --see
(viewtopic.php?f=21&t=1926)

the direct link is

https://github.com/downloads/jlaake/RMa ... _2.0.8.zip


If you don't mind posting the code you mentioned for the epsilon=1-gamma parameterization (or the direct link to the help file), that would be all I need. Thanks again- liz


No sweat, see below.

Code: Select all
# Example of epsilon=1-gamma
test_proc=process.data(RDOccupancy,model="RDOccupEG",time.intervals=c(0,0,1,0,0,1,0,0))
test_ddl=make.design.data(test_proc)
test_ddl$Epsilon$eps=-1
test_ddl$Gamma$eps=1
p.dot=list(formula=~1)
Epsilon.random.shared=list(formula=~-1+eps, share=TRUE)
model=mark(test_proc,test_ddl,model.parameters=list(Epsilon=Epsilon.random.shared, p=p.dot))

Re: Comparing different parameterizations of RDOccupancy

PostPosted: Thu Sep 22, 2011 12:01 pm
by ekalies
Perfect. sorry i missed the RMark release, but the code is really what I needed. Thanks!!

Re: Comparing different parameterizations of RDOccupancy

PostPosted: Fri Sep 23, 2011 3:27 pm
by bacollier
Although it took a day or 2 (getting old I suppose), answering this jogged my memory that about 3 years ago I had asked Gary about how to code the random colonization modeling in MARK for a project I was working on and he sent me a detailed explanation (which I have quoted below pretty much exactly as he emailed me) that might be of some interest to folks as it is similar to what was described above and how Jeff use’s share to accomplish roughly the same thing in RMark.

You will notice that Gary used 'clever' as a qualifier on how to be 'sneaky' about how you code the DM to do this...

The random colonization models assumes that the occupancy status of a site is the same at time t+1 regardless of its status at time t. In other words, 1 – epsilon = gamma. Occupied sites remain occupied with probability 1 – epsilon, and unoccupied sites become occupied with probability gamma. So, random colonization.

The way you do this in MARK is to code epsilon with a -1 and gamma with a +1 for the same beta. Below is what I have added to the help file to clarify this trick, which I’ll update on the web tomorrow at school. Also works with the Pradel f and Link-Barker data types to force lambda = 1 for the f models. Not sure this is a useful approach since you can just run the Pradel lambda model with lambda = 1, but nice to know about it .

One model often of interest is the random extinction and colonization model, where the probability of a site being occupied at time t+1 is the same regardless of whether or not the site was occupied at time t. You can obtain estimates for this model in MARK by clever coding of the design matrix. Suppose the epsilon of interest is parameter 2 in the PIM, and the gamma of interest is parameter 3 in the PIM. Use a common beta parameter for both epsilon and gamma, i.e., there will be a single column that is modeled by both rows 2 and 3 of the design matrix. If
you specify a logit link for both epsilon and gamma, and code epsilon as -1 in the design matrix and gamma as +1, the result is the model with 1 - epsilon = gamma. The design matrix looks like:

Columns: B1 B2 B3

Row 1: 1 0 0

Row 2: 0 -1 0 /* This is epsilon */

Row 3: 0 1 0 /* This is gamma */

You also get the same results if you use a sin link instead of a logit link, because both link functions are symmetric about 0.5.

For those of you that want to be more complicated, you can also code epsilon with -1 and use a cloglog link, and gamma with 1 and use a loglog link, and get the same result as you would with the logit link. Likewise, you can reverse the 2 link funcitons, or reverse the -1 and 1, and still get the same model, but with different interpretations of
the estimate of beta.

The -1 logit link approach also works with covariates, either temporal, group, or individual covariates. Assume the following PIMs:

Epsilon PIM

2 3 4

3 4

4

Gamma PIM

5 6 7

6 7

7

Further assume that you have the time-varying covariate with values 11, 12, and 13 for the 3 time intervals. The design matrix then looks like:

Row 1: 1 0 0

Row 2: 0 -1 -11

Row 3: 0 -1 -12

Row 4 0 -1 -13

Row 5 0 1 11

Row 6: 0 1 12

Row 7: 0 1 13

Similarly, if you have an individual covariate named "covariate", you have to use the design matrix function to specify a negative value for the covariate:

Row 1: 1 0 0

Row 2: 0 -1 product(-1,covariate)

Row 3: 0 -1 product(-1,covariate)

Row 4 0 -1 product(-1,covariate)

Row 5 0 1 covariate

Row 6: 0 1 covariate

Row 7: 0 1 covariate

In all of these cases, the estimate of gamma = 1 - epsilon.


Re: Comparing different parameterizations of RDOccupancy

PostPosted: Fri Sep 23, 2011 3:38 pm
by cooch
bacollier wrote:Although it took a day or 2 (getting old I suppose), answering this jogged my memory that about 3 years ago I had asked Gary about how to code the random colonization modeling in MARK for a project I was working on and he sent me a detailed explanation (which I have quoted below pretty much exactly as he emailed me) that might be of some interest to folks as it is similar to what was described above and how Jeff use’s share to accomplish roughly the same thing in RMark.

You will notice that Gary used 'clever' as a qualifier on how to be 'sneaky' about how you code the DM to do this...


The same 'clever' DM approach that Brett refers to (and which Gary describes) is also the one used to tweak the RD model for the 'even flow' model -- see pp. 38-39 in Chapter 15 for a demonstration. The idea (and motivation) are basically the same.