Getting the basics...Transient models in MARK

questions concerning analysis/theory using program MARK

Getting the basics...Transient models in MARK

Postby aber_r16 » Mon Jun 01, 2015 2:34 pm

HI, Im still working away on these transient models. My ultimate goal is to run them in RMark but I don't think I have the theory correct and thus have gone back to basics to test my theoretical understanding.

I built the same model twice in MARK- once with PIMS and once with the Design matrix. I don't understand why they give me slightly different results.

PIMS

Phi
1 6 7 8 9
2 7 8 9
3 8 9
4 9
5
P
10 11 12 13 14
11 12 13 14
12 13 14
12 14
12

The design matrix used is:
Phi:
1 1 1 0 0 0 0 0 0
1 1 0 1 0 0 1 0 0
1 1 0 0 1 0 0 1 0
1 1 0 0 0 1 0 0 1
1 1 0 0 0 0 0 0 0
1 0 0 1 0 0 0 0 0
1 0 0 0 1 0 0 0 0
1 0 0 0 0 1 0 0 0
1 0 0 0 0 0 0 0 0

p:
1 1 0 0 0
1 0 1 0 0
1 0 0 1 0
1 0 0 0 1
1 0 0 0 0

The AIC values are:
Phi(2m-tt)phi(t) via PIM: 595.9186 with 6 parameters
Phi(2m-tt)phi(t) via DM: 598.4148 with 13 parameters

To me these models should be equivalent....They are not and I am not sure why. I have read and reread chapter 7 on Age models so hoping someone can point out what Im missing.

Thanks, Robin
aber_r16
 
Posts: 18
Joined: Wed Feb 04, 2015 4:45 pm

Re: Getting the basics...Transient models in MARK

Postby jlaake » Mon Jun 01, 2015 2:59 pm

What are you trying to accomplish with the DM? If you want 9 parameters for Phi then you could use an identity matrix or an intercept structure like you did for p. Why are you making Phi DM so complicated?

It appears you are trying to create an age*time model with 3 age classes. Below is what RMark would do:
Code: Select all
df=data.frame(age=cut(c(rep(1,5),rep(2,4),rep(3,3),rep(4,2),5),c(1,2,6),right=FALSE),time=factor(c(1:5,2:5,3:5,4:5,5)))
DM=model.matrix(~-1+age:time,df)
DM[,colSums(DM)!=0]


Try it in R to see the result. Note that age 2 is only from time 2 onward, age 3 from time 3 onward so you need to use ~-1+age:time to limit terms for age across times where you had animals marked of that age and use -1 to remove intercept. RMark removes the 0 columns.

--jeff
jlaake
 
Posts: 1479
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: Getting the basics...Transient models in MARK

Postby cooch » Mon Jun 01, 2015 3:32 pm

jlaake wrote:What are you trying to accomplish with the DM? If you want 9 parameters for Phi then you could use an identity matrix or an intercept structure like you did for p. Why are you making Phi DM so complicated?


Because that is the DM for a model with 2 age-classes, full time variation in both age classes. RTFM. ;-) [Note: this is the very first time I've ever used this expression, and I get to unleash it on Jeff Laake...my day is made.]

Have a look at the Dipper example, section 7.2. Using that, but considering the DM shown in the OP, with some spaces to make columns groupings easier to identify

Code: Select all
1  1  1 0 0 0  0 0 0
1  1  0 1 0 0  1 0 0
1  1  0 0 1 0  0 1 0
1  1  0 0 0 1  0 0 1
1  1  0 0 0 0  0 0 0
1  0  0 1 0 0  0 0 0
1  0  0 0 1 0  0 0 0
1  0  0 0 0 1  0 0 0
1  0  0 0 0 0  0 0 0


First column is the intercept. Second is the age 'group' - note, 5 1's for the first juvenile age, 4 0's for the subsequent adult stage. Columns 3-6 are the time steps (note that there are no adults for the second age) group, so the first time step is not included in the coding). Then, interactions of age and time -- including only those time steps here both age classes are represented (i.e., starting at the second interval).

So, the DM is correct. However, my guess is that the OP applied it to the wrong PIM structure.

Having done this sort of DM-based analysis (oh, say) 1000's of times, I can guarantee you it is correct. Its worth mentioning that this structure is very important, because it shows up again, and again, and again. For example, it is *identical* to the DM for closed abundance with full time-dependence in p and c. Yes, I know it is not an estimable model, but the DM is identical to the age model -- and it represents a starting point).
cooch
 
Posts: 1652
Joined: Thu May 15, 2003 4:11 pm
Location: Cornell University

Re: Getting the basics...Transient models in MARK

Postby aber_r16 » Mon Jun 01, 2015 3:58 pm

Thanks for the help Jeff and Cooch! I am indeed needing a model with 2 age-classes, full time variation.

It is reassuring to confirm the structure of the DM is correct for what Im trying to do. However, Im confused as to your comment

So, the DM is correct. However, my guess is that the OP applied it to the wrong PIM structure.


I applied it to the same PIM structure I provided in the OP. Is that incorrect?
aber_r16
 
Posts: 18
Joined: Wed Feb 04, 2015 4:45 pm

Re: Getting the basics...Transient models in MARK

Postby cooch » Mon Jun 01, 2015 4:10 pm

aber_r16 wrote:Thanks for the help Jeff and Cooch! I am indeed needing a model with 2 age-classes, full time variation.

It is reassuring to confirm the structure of the DM is correct for what Im trying to do. However, Im confused as to your comment

So, the DM is correct. However, my guess is that the OP applied it to the wrong PIM structure.


I applied it to the same PIM structure I provided in the OP. Is that incorrect?


Look at your original post. For the PIM model, you report 6 parameters. That is not possible. You have 14 structural parameters in your PIMs (although not all are identifiable -- but the number that are is definitely >6 as you report). You must have done something, somewhere.

Send mr the .dbf and .fpt files offline, and I'll have a look. In the meantime, work through the dipper example in 7.2 of chapter 7. If you do, then you'll see that the PIM and DM models yield identical...everything. That means you're doing it right. If they don't line up for your data, then I suspect something is amiss.
cooch
 
Posts: 1652
Joined: Thu May 15, 2003 4:11 pm
Location: Cornell University

Re: Getting the basics...Transient models in MARK

Postby aber_r16 » Mon Jun 01, 2015 4:15 pm

and the link function strikes again....Sin vs logit.

got it thanks now, thanks!
aber_r16
 
Posts: 18
Joined: Wed Feb 04, 2015 4:45 pm

Re: Getting the basics...Transient models in MARK

Postby cooch » Mon Jun 01, 2015 4:25 pm

aber_r16 wrote:and the link function strikes again....Sin vs logit.

got it thanks now, thanks!


PIM defaults to sin, and I'd still be concerned that you're reporting 6 parameters.

One additional note -- comparing AICc to assess model 'equivalence' gets you into trouble. Compare the model deviance instead. If two models (say, PIM-based and DM-based) yield the same deviance, they're equivalent. If they don't, then they're not.

Then, and only then, look at the AIC values. If they differ, then culprit must be number of parameters being estimated. And, then you need to wrestle with adjusting parameter counts as needed.
cooch
 
Posts: 1652
Joined: Thu May 15, 2003 4:11 pm
Location: Cornell University

Re: Getting the basics...Transient models in MARK

Postby jlaake » Mon Jun 01, 2015 4:52 pm

You state that it "is THE DM for a model with 2 age-classes, full time variation in both age classes". As you know, there is no single DM. That is a DM that will work. My point was that if she had the PIM set up as she described then using an identity DM would have worked. The DM I also constructed would have worked as well. I was unclear what she was doing and why she was doing it. Also when you give a DM like that without any column labels they aren't particularly easy to read which is one of the reasons I wrote RMark. Formula are much easier and with model.matrix in R you get the labels gratis. I don't need to RTFM for DMs :D . I have formulas and let R do that menial job. With the formula I used for the DM, you could have specified the sin link.

I fully agree with regard to your statement to compare deviance values rather than AIC values. Yet another reason why I don't like the parameter counting approach in MARK. If it worked equally well for all link functions it would be much more useful.
jlaake
 
Posts: 1479
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: Getting the basics...Transient models in MARK

Postby cooch » Mon Jun 01, 2015 5:03 pm

jlaake wrote:You state that it "is THE DM for a model with 2 age-classes, full time variation in both age classes". As you know, there is no single DM. That is a DM that will work.


Point taken. Of course that is true. But, the identity matrix doesn't allow you to model interesting interactions between age classes, which is frequently the point of the exercise.

My point was that if she had the PIM set up as she described then using an identity DM would have worked. The DM I also constructed would have worked as well. I was unclear what she was doing and why she was doing it. Also when you give a DM like that without any column labels they aren't particularly easy to read which is one of the reasons I wrote RMark. Formula are much easier and with model.matrix in R you get the labels gratis. I don't need to RTFM for DMs :D .


Oh, come on. You know you need to. First step in the process is admitting... ;-)

Besides, I find looking at columns of 1s and 0s more intuitive than R code. But you already knew that. ;-)

I have formulas and let R do that menial job. With the formula I used for the DM, you could have specified the sin link.
,/quote]

You can with the DM approach too, but you need to know where to flip the 'secret switch'.

I fully agree with regard to your statement to compare deviance values rather than AIC values. Yet another reason why I don't like the parameter counting approach in MARK. If it worked equally well for all link functions it would be much more useful.


Nah, not gonna bite on that one. Too late in my day.
cooch
 
Posts: 1652
Joined: Thu May 15, 2003 4:11 pm
Location: Cornell University

Re: Getting the basics...Transient models in MARK

Postby jlaake » Mon Jun 01, 2015 5:48 pm

Aw come on. I love poking the bear! But no fun if he doesn't react. Maybe tomorrow after come coffee. 1's and 0's are great if you are a computer and read binary code. Not so great for us mere mortals. I'll stick with my formulas.

As you know, no matter what DM you use, you can always construct a linear contrast for whatever comparison (interaction) you may want. If beta is the portion of the parameter vector for Phi resulting from the DM I constructed with the formula, then

Code: Select all
lc=cbind(c(0,1,-1,rep(0,6)),c(0,0,0,1,-1,rep(0,4)),c(rep(0,4),0,1,-1,rep(0,2)),c(rep(0,6),0,1,-1))
beta%*%lc

would give the differences between the 2 age classes for each time and
Code: Select all
t(lc)%*%V%*%lc

provides the variance-covariance matrix of the differences where V is the v-c matrix of the betas.

Hey I got a t-shirt the other day that you'll love. It says

I can explain it to you
but I can't understand it for you!
jlaake
 
Posts: 1479
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Next

Return to analysis help

Who is online

Users browsing this forum: No registered users and 1 guest

cron