Constraining an age model, failing to access design matrix

questions concerning analysis/theory using program MARK

Constraining an age model, failing to access design matrix

Postby Nachoman » Sun Jun 28, 2009 3:30 pm

Hi all,

I am trying to constrain an age model (CJS) for a dataset that has both animals marked as young and adults (i.e. similar to the one on chapter 7- page27). With the PIMs it's quit straight forward but as I am aiming to build additive models I am trying to design it using the Design Matrix.

Maybe I am being really really dumb here, but my problem is that I cannot find a way to obtain the right number of rows in the design matrix needed to code for "age at marking" + "age effects" (i.e. get from page 7-15 to page 7-16, to put it in a simple way). Briefly, the default in MARK is time dependent, so say I have 5 time occasions for animals marked as young (in reality I have more, but this serves to illustrate my problem), MARK fits this model by default:

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



and then the default design matrix has 5 rows for this group*parameter.

Now if what I want is
Code: Select all
6 2 3 4 5
  7 3 4 5
    8 4 5
      9 5   
        10


Clearly I would like to have a design matrix with 9 rows for this group*parameter.

I have tried modifying the PIM chart or the PIMs themselves to "all different" for that group (which would allow me to construct the adequate design matrix), but when asking MARK to provide the FULL design matrix for this modified "all different" model, it replies that "cannot build a full design matrix because there are 180 values in the PIMS, but should be 144". (144 values=rows is what my CJS model has with full time dependency in phi and p).

I have looked through the manual many times but cannot find any reference to it. I am getting really frustrated, I have my design matrixes ready to go, but I just cannot code them....

So I would really appreciate any help.

Thanks a lot,

Nacho
Nachoman
 

Re: Constraining an age model, failing to access design matr

Postby cooch » Mon Jun 29, 2009 10:36 am

Nachoman wrote:Hi all,

I am trying to constrain an age model (CJS)


They're referred to as TSM models, in general.


I have tried modifying the PIM chart or the PIMs themselves to "all different" for that group (which would allow me to construct the adequate design matrix), but when asking MARK to provide the FULL design matrix for this modified "all different" model, it replies that "cannot build a full design matrix because there are 180 values in the PIMS, but should be 144". (144 values=rows is what my CJS model has with full time dependency in phi and p).


So, you simply use the 'reduced' option, and enter as many columns as you need. This is specified in the help file. Note that the book is not a replacement (or substitute) for checking the help file.
cooch
 
Posts: 1654
Joined: Thu May 15, 2003 4:11 pm
Location: Cornell University

Re: Constraining an age model, failing to access design matr

Postby Nachoman » Mon Jun 29, 2009 1:53 pm

Thanks, but I guess my question though equally basic is a different one. Say the default CJS model for phi for a given group would look like:

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


and the corresponding design matrix

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


and what I want is a TSM model like:

Code: Select all
6 2 3 4 5
  7 3 4 5
    8 4 5
      9 5   
        10


and again the corresponding design matrix with time interaction

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


Then getting extra colums is an easy task as you pointed out, but how do I get the extra rows to code for TSM effects? Asking MARK for the full design matrix, brings up a design matrix with 4 rows, but in reality I need 7 rows; asking for the reduced matrix just brings up more columns but no more rows...

Thanks again,

Nacho
Nachoman
 

Re: Constraining an age model, failing to access design matr

Postby cooch » Mon Jun 29, 2009 2:35 pm

Nachoman wrote:Thanks, but I guess my question though equally basic is a different one. Say the default CJS model for phi for a given group would look like:

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


and the corresponding design matrix

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



Incorrect. If your PIM indexes 1 -> 5 (which corresponding to 6 sampling occasions - 5 intervals), then the DM corresponding to that would be

Code: Select all
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


You seem to be making this error consistently, which suggests you might not fully understand the relationship between PIMs and DMs.

and what I want is a TSM model like:

Code: Select all
6 2 3 4 5
  7 3 4 5
    8 4 5
      9 5   
        10




Again, not sure really what you're trying to do, or which age class this is referring to - presumably 'marked as babies' (given the structure). This implies that the PIM structure for marked as adults is

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


or some such.

If true, then your DM structure (given these example PIMs for the two age-marking classes) for the full interaction model (age of marking X time) is simple. Because you're assuming that 'an adult is an adult' regardless of the age at which it is marked (as an aside, this is usually a strong - i.e., naive - assumption you should test), then all you need to do is

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



If you run this, and compare it with the PIM model, they should yield identical deviance. The number of rows assigned by MARK for a given parameter is determined by the PIM indexing for that parameter. In this example, the PIMs indicate 10 parameters (1 -> 10), so, 10 rows. Its that simple.

I have a suspicion you're not fully understanding the connection between PIMs, parameters, and DM. Before getting into esoterica of TSM models, make sure you thoroughly understand the material in Chapter 6. Your very first code snippet implies a basic misunderstanding. Your PIM codes for 5 parameters, but your DM is constructed only for 4 - hence the problem (in your words) in the 'number of rows'.
cooch
 
Posts: 1654
Joined: Thu May 15, 2003 4:11 pm
Location: Cornell University

Design Matrices for Time-Since-Marking Models

Postby B.K. Sandercock » Mon Jun 29, 2009 6:04 pm

Going from the DM for the straight CJS model with time dependence to the TSM model can be a bit tricky and I always have to wrestle with the menus to remind myself how to do it in Mark. The issue arises because Mark has menu options for adding *columns* but when you go from CJS to TSM you need to add *rows* to accomodate the offdiagonal parameters.

My recollection is that the way you can add the necessary rows is to first set up a TSM model first with the PM, and then retrieve an identity matrix for the TSM model, think you have to select 'Full' to get the additional rows. If you want reduced models, then you have to edit the DM structure.

A model structure that I find helpful for running TSM models is outlined as follows.

Starting with a CJS model with 5 intervals (6 occasions) and one group, here is example code for one parameter, such as apparent survival (phi).

PM
1 2 3 4 5
2 3 4 5
3 4 5
4 5
5

DM
1 0 0 0 0
1 1 0 0 0
1 0 1 0 0
1 0 0 1 0
1 0 0 0 1

And going to a TSM model with 5 intervals (6 occasions) and one group.

PM
1 6 7 8 9
2 7 8 9
3 8 9
4 9
5

DM
1 0 0 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0 0 0
1 0 1 0 0 0 0 0 0 0
1 0 0 1 0 0 0 0 0 0
1 0 0 0 1 0 0 0 0 0
0 0 0 0 0 1 1 0 0 0
0 0 0 0 0 1 0 1 0 0
0 0 0 0 0 1 0 0 1 0
0 0 0 0 0 1 0 0 0 1

Notes: The upper left hand 5x5 block is the first transition, lower right hand 4x5 block is the subsequent transitions. Lower right is one row shorter because you don't start the offdiagonal transitions until after the second occasion.

Did not RTM to see if this trick is already included in the manual, just posting here in case anybody is searching the archive.

Good luck, Brett
B.K. Sandercock
 
Posts: 48
Joined: Mon Jun 02, 2003 4:18 pm
Location: Norwegian Institute of Nature Research

Re: Design Matrices for Time-Since-Marking Models

Postby cooch » Mon Jun 29, 2009 6:16 pm

B.K. Sandercock wrote:Going from the DM for the straight CJS model with time dependence to the TSM model can be a bit tricky and I always have to wrestle with the menus to remind myself how to do it in Mark. The issue arises because Mark has menu options for adding *columns* but when you go from CJS to TSM you need to add *rows* to accomodate the offdiagonal parameters.

My recollection is that the way you can add the necessary rows is to first set up a TSM model first with the PM, and then retrieve an identity matrix for the TSM model, think you have to select 'Full' to get the additional rows. If you want reduced models, then you have to edit the DM structure.


Brett is essentially correct. The PIMs determine the number of rows. Period. You can't go from a PIM structure for CJS -> a TSM simply by modify the DM. Period. If you want a TSM model, you (i) set it up in PIMs, then (ii) specify the DM corresponding to it.
cooch
 
Posts: 1654
Joined: Thu May 15, 2003 4:11 pm
Location: Cornell University

Re: Constraining an age model, failing to access design matr

Postby cooch » Mon Jun 29, 2009 8:49 pm

cooch wrote:So, you simply use the 'reduced' option, and enter as many columns as you need. This is specified in the help file. Note that the book is not a replacement (or substitute) for checking the help file.


Forgot to mention that a fairly complete explanation of the differences between the 'full', 'reduced', and 'identity' options can be found on p. 22 of Chapter 6:

http://www.phidot.org/software/mark/doc ... /chap6.pdf

Note that selecting the 'identity' matrix and the default for the 'reduced' matrix will give you a square matrix in either case (with the dimensions corresponding to the number of parameters specified in the PIMs) - the only difference is that the identity has 1's along the diagonal, whereas the 'reduced' matrix is always entirely empty (i.e., consists entirely of 0's). The full DM is generated *only* if the underlying PIM structure is a full group(s) by time model.
cooch
 
Posts: 1654
Joined: Thu May 15, 2003 4:11 pm
Location: Cornell University

Re: Design Matrices for Time-Since-Marking Models

Postby cooch » Mon Jun 29, 2009 8:55 pm

Brett is essentially correct. The PIMs determine the number of rows. Period. You can't go from a PIM structure for CJS -> a TSM simply by modify the DM. Period. If you want a TSM model, you (i) set it up in PIMs, then (ii) specify the DM corresponding to it.


My comment, of course, is not entirely true if you use RMark, which uses the 'all different' underlying PIM structure - to which any number of constraints can be applied. Of course, you don't do this with the design matrix in RMark, but using the RMark 'langauge' to specify the appropriate model structure. Some people who struggle with creating DM's (or who find them 'offensive') find RMark a far less cumbersome approach.
cooch
 
Posts: 1654
Joined: Thu May 15, 2003 4:11 pm
Location: Cornell University


Return to analysis help

Who is online

Users browsing this forum: No registered users and 3 guests