Design matrices for transient models

questions concerning analysis/theory using program MARK

Design matrices for transient models

Postby annaren » Tue Mar 04, 2008 2:24 pm

I am having REAL problems making the design matrices for a model {Phi'(g*t) Phi (g*t) p(g*t)} with 4 trap ocassions and 4 groups.
I can run the model using PIMS but that means I can not add constraints to the model. When I try to view the design matrix for the model made using the PIM it says it can not build a full design matrix because there are 20 values in the PIMS but should be 24. When I try to contruct the design matrix myself I can not get the same output as when using the PIMS.
I have read chapters 7 and 8 in the MARK book a number of times now so I was wondering if anybody had any idea as to how to procede.
annaren
 
Posts: 25
Joined: Tue Mar 04, 2008 12:00 pm
Location: University of Aberdeen

Re: Design matrices for transient models

Postby cooch » Tue Mar 04, 2008 3:40 pm

annaren wrote:I am having REAL problems making the design matrices for a model {Phi'(g*t) Phi (g*t) p(g*t)} with 4 trap ocassions and 4 groups.
I can run the model using PIMS but that means I can not add constraints to the model. When I try to view the design matrix for the model made using the PIM it says it can not build a full design matrix because there are 20 values in the PIMS but should be 24. When I try to contruct the design matrix myself I can not get the same output as when using the PIMS.
I have read chapters 7 and 8 in the MARK book a number of times now so I was wondering if anybody had any idea as to how to procede.


Always tricky to play with transient models (and TSM models in general), but if you write out the linear model, and then construct the DM from the linear model, they're not too bad - but you need to be careful when handling some of the interactions.

Consider a simpler problem first (invariable a good idea until you're comfortable with the concept) - two groups (call them males and females), 5 occasions. Assume we're only interested in transience on phi in an CJS-type study. The PIMs corresponding to this would be for males,

Code: Select all
1 5 6 7
  2 6 7
    3 7
      4


and females

Code: Select all
8  12  13 14
    9  13 14
       10 14
          11



The first trick is to remember that the linear model is essentially

Intcp + sex + age (within sex) + time + a*s + a*t + s*t + a*s*t

Most people forget to include the a*s interaction.

Thus, for this problem, the DM would look like

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


where

col 1 = incpt
col 2 = sex
col 3 = age (within sex - note offeset for TSM+1 age)
col 4 -> 6 = time (t1, t2, t3)
col 7 = s*a
col 8 -> 10 = s*t (s*t1, s*t2, s*t3)
col 11 -> 12 = a*t (a*t2, a*t3)
col 13 -> 14 = s*a*t (s*a*t2, s*a*t3)

Pay particular attention to how the interactions are handled - especially those wrt to time and age. Only logical interactions are included in the DM - see section 8.1.1.

Now, if you understand the preceding, then your problem is basically the same, except with more groups.
cooch
 
Posts: 1654
Joined: Thu May 15, 2003 4:11 pm
Location: Cornell University

Simpler example

Postby jlaake » Tue Mar 04, 2008 9:35 pm

Evan's post is a lot more detailed. Here is a simpler example that matches the size you specified.

I assume this is CJS (recaptures only). Is the following PIM for one group what you are trying to do?

Code: Select all
1 2 3
  4 3
    5


where survival after first capture is different than survival of previously caught? The all-different PIM structure would be

Code: Select all
1 2 3
  4 5
    6


It would have 24 (4*6) parameters for Phi and 24 for p with 4 groups. The PIM coding would only have 20 (4*5). If you make the PIMS all different then you can code the above PIM as a design as follows

1 1 0 0 0 0
2 0 1 0 0 0
3 0 0 1 0 0
4 0 0 0 1 0
5 0 0 1 0 0
6 0 0 0 0 1

All the above does is use the same column for 3&5 in the lower PIM which are both represented by 3 in the upper PIM. It has 5 columns because you only have 5 unique parameters.

You'll need to go through Evan's explanation if you consider interactions of groups etc.

Hope this helps. --jeff
jlaake
 
Posts: 1480
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: Design matrices for transient models

Postby egc » Tue Mar 04, 2008 10:15 pm

annaren wrote: I can not get the same output as when using the PIMS.
I have read chapters 7 and 8 in the MARK book a number of times now so I was wondering if anybody had any idea as to how to procede.


I should also add that when comparing a model constructed with PIMs, and one constructed with a DM, you should compare model deviances. If the deviance from your DM matches that for the PIM model, you're set. Because the DM defaults to a logit link, whereas the PIM defaults to a sin link, you may see differences in the number of estimable parameters between the two - which will yield different AIC values. Those differences can be dealt with by manually adjusting the number of parameters as needed. The deviance is what you should be looking at.
egc
Site Admin
 
Posts: 201
Joined: Thu May 15, 2003 3:25 pm

Re: Simpler example

Postby egc » Wed Mar 05, 2008 10:37 am

jlaake wrote:If you make the PIMS all different then you can code the above PIM as a design as follows

1 1 0 0 0 0
2 0 1 0 0 0
3 0 0 1 0 0
4 0 0 0 1 0
5 0 0 1 0 0
6 0 0 0 0 1


Actually, this should be

1 1 0 0 0 0
1 0 1 0 0 0
1 0 0 1 0 0
1 0 0 0 1 0
1 0 0 1 0 0
1 0 0 0 0 1
egc
Site Admin
 
Posts: 201
Joined: Thu May 15, 2003 3:25 pm

Re: Simpler example

Postby egc » Wed Mar 05, 2008 11:00 am

egc wrote:
jlaake wrote:If you make the PIMS all different then you can code the above PIM as a design as follows

1 1 0 0 0 0
2 0 1 0 0 0
3 0 0 1 0 0
4 0 0 0 1 0
5 0 0 1 0 0
6 0 0 0 0 1


Actually, this should be

1 1 0 0 0 0
1 0 1 0 0 0
1 0 0 1 0 0
1 0 0 0 1 0
1 0 0 1 0 0
1 0 0 0 0 1


Sigh, in fact, should be:

1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 1 0 0
0 0 0 0 1


The column of 1's I had in my first quick reply won't affect the reconstituted estimates on the real scale, but the beta estimates will be nonsense.

Personal note: don't post things when sleep deprived. ;-)
egc
Site Admin
 
Posts: 201
Joined: Thu May 15, 2003 3:25 pm

Postby annaren » Fri Mar 07, 2008 6:41 am

Thanks for your reply however I have an additional problem! I have managed to create the design matrix for the TSM model {Phi'(g*t) Phi (g*t) p'(g*Tt) p(g*t)} (transient adn trap dependence model with 4 groups and 4 trap occassions) with the following columns for phi:

B1 - intercept
B2 - m2
B3 - group 1
B4 -group 2
B5 - group 3
B6 - time 1
B7- time 2
B8 - m2 *g1
B9 - m2*g2
B10 - m2*g3
B11 - m2*t2
B12 -t1*g1
B13 - t1*g2
B14 - t1*g3
B15 - t2*g1
B16 - t2*g2
B17 - t3*g3
B18 - m2*g1*t2
B19 - m2*g2*t2
B20 - m2*g3*t2

The same column heading were used to create the p part of the matrix. Using the design matrix approach I get exactly the same AIC, deviation adn no of parameters as if I madethe model using the PIMS but the estimates of phi adn p are different for the end products of each group i.e phi 5 and p25 ( both methods use LOGIT)
Firstly, I dont know why the values of phi adn p should be different adn secondly MARK estimates 26 parameters which I really can not undersatnd which ones it is estimating. I would have thought it should have been able to estimates 32 or the 40 inputted.
Many thanks again.
annaren
 
Posts: 25
Joined: Tue Mar 04, 2008 12:00 pm
Location: University of Aberdeen

Postby cooch » Fri Mar 07, 2008 8:13 am

annaren wrote:Thanks for your reply however I have an additional problem! I have managed to create the design matrix for the TSM model {Phi'(g*t) Phi (g*t) p'(g*Tt) p(g*t)} (transient adn trap dependence model with 4 groups and 4 trap occassions) with the following columns for phi:

B1 - intercept
B2 - m2
B3 - group 1
B4 -group 2
B5 - group 3
B6 - time 1
B7- time 2
B8 - m2 *g1
B9 - m2*g2
B10 - m2*g3
B11 - m2*t2
B12 -t1*g1
B13 - t1*g2
B14 - t1*g3
B15 - t2*g1
B16 - t2*g2
B17 - t3*g3
B18 - m2*g1*t2
B19 - m2*g2*t2
B20 - m2*g3*t2

The same column heading were used to create the p part of the matrix. Using the design matrix approach I get exactly the same AIC, deviation adn no of parameters as if I madethe model using the PIMS but the estimates of phi adn p are different for the end products of each group i.e phi 5 and p25 ( both methods use LOGIT)
Firstly, I dont know why the values of phi adn p should be different adn secondly MARK estimates 26 parameters which I really can not undersatnd which ones it is estimating. I would have thought it should have been able to estimates 32 or the 40 inputted.
Many thanks again.


Quick suggestions:

1. try changing the reference structure for how you code the DM (see the -sidebar - starting on p. 70 of Chapter 7). That 'trick' works more often than not (for the reasons explained there). If the deviance values are the same between the two, then the DM is correct. If some parameters aren't being identified (for the same link), its a numerical issue probably related to coding choices.

2. don't get too fussed if some of the parameters in the general model aren't identifiable - especially 'terminal' parameters. You're unlikely to be using that model for the bulk of your inference anyway.
cooch
 
Posts: 1654
Joined: Thu May 15, 2003 4:11 pm
Location: Cornell University

Transience models

Postby annaren » Mon Mar 10, 2008 12:05 pm

I think I may have found the problem but not sure as I can not find any mention of it in the MARK book. I have not coded the input file with those caught only once and those caught more than once. Instead of having the four groups (female narrow, female wide, male narrow, male wide) should I infact have 8 (thouse caught only once and those caught more than once for each group).
Thanks,
Anna
annaren
 
Posts: 25
Joined: Tue Mar 04, 2008 12:00 pm
Location: University of Aberdeen

Re: Transience models

Postby cooch » Mon Mar 10, 2008 12:22 pm

annaren wrote:I think I may have found the problem but not sure as I can not find any mention of it in the MARK book. I have not coded the input file with those caught only once and those caught more than once. Instead of having the four groups (female narrow, female wide, male narrow, male wide) should I infact have 8 (thouse caught only once and those caught more than once for each group).
Thanks,
Anna


Not sure what the problem is, or really what you're trying to do. In general, there is no reason to have seen once versus seen more than once as separate groups. For a transience analysis, all you do is build a TSM model. Period. You don't do anything in the .inp file.
cooch
 
Posts: 1654
Joined: Thu May 15, 2003 4:11 pm
Location: Cornell University

Next

Return to analysis help

Who is online

Users browsing this forum: No registered users and 1 guest