Design Matrix for transients

questions concerning analysis/theory using program MARK

Design Matrix for transients

Postby Mariana Mira » Thu Apr 24, 2008 9:15 am

I am trying to construct a design matrix with survival constant in time with only a transient effect in survival. I have read the Mark documentation and I just found how to contruct a design matrix with age effect varying with time. I tryed to construct a design matrix, but the result is not the same as using PIM, so I think that I did something wrong. My design matrix gives the same result as with sex effect (males and females) and not with only transient effect (with no sex effect). Can anybody help me? My PIM for survival look like this for males and females:

1222222
122222
12222
1222
122
12
1
Mariana Mira
 
Posts: 11
Joined: Thu Mar 01, 2007 10:25 am
Location: Brasília, Brasil

Re: Design Matrix for transients

Postby cooch » Fri Apr 25, 2008 10:11 am

Mariana Mira wrote:I am trying to construct a design matrix with survival constant in time with only a transient effect in survival. I have read the Mark documentation and I just found how to contruct a design matrix with age effect varying with time. I tryed to construct a design matrix, but the result is not the same as using PIM, so I think that I did something wrong. My design matrix gives the same result as with sex effect (males and females) and not with only transient effect (with no sex effect). Can anybody help me? My PIM for survival look like this for males and females:

1222222
122222
12222
1222
122
12
1


There are at least 2 ways you could approach this problem. But, I'll describe the most flexible. For purposes of this example, assume two groups (say, males and females), with 5 encounter occasions. A priori, we'll assume there is potential for time-variation in phi. We'll assume no variation in p between groups or over time. Assume also we suspect the possibility of 'transients' in the marked samples. So, our PIMS would look like - for males (assume males are the first group in the INP file)

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


and for females

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


Now, the DM corresponding to these PIMs is a bit tricky, but not too bad if you take your time, and pay attention. First, you write out the linear model as

phi = int + sex + age + time + sex*age + sex*time + age*time + sex*age*time.

Next, you need to notice that not all time intervals apply to all TSM classes in the model (discussed in detail in Chapter 8). I've added some blank columns to make the sections more obvious.

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


Column 1 is the intercept, column two codes for sex, column three age (where 1's indicate first TSM class), columns 4-6 time intervals (pay attention to the coding here), column 7 is the S*A interaction, columns 8-9 are the A*time interactions (again, pay attention to which intervals actually have an interaction with age - see Chapter 8), columns 10-12 are the S*time interactions, columns 13-14 are the A*S*time interactions, and column 15 is the encounter rate.

Now, this is a pretty general model, and you can reduce it in a straightforward manner simply be deleting columns. For example, in your original note, you said you wanted constant over time within each TSM class, but different between groups. Easy, simply delete the time columns from the DM, and any interaction columns involving time:

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


This DM constrains your time-dependent PIMS to be entirely equivalent to



Code: Select all
1  2  2  2
   1  2  2
      1  2
         1


and for females

Code: Select all
3  4  4  4
   3  4  4
      3  4
         3


In general, I suggest building the DM for a general, time-dependent model first, then constraining it (i.e., build reduced parameter models) byy adding/deleting/changing columns in this DM. A bit more work up front, but generally worth it in the end.

If you really want the DM corresponding to the time-constant PIMS, for this example it would look like

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


Have another read through both Chapter 7, and Chapter 8. All the preceding is discussed in both chapters, implicitly if not explicitly.
cooch
 
Posts: 1654
Joined: Thu May 15, 2003 4:11 pm
Location: Cornell University

Re: Design Matrix for transients

Postby Mariana Mira » Sat Apr 26, 2008 8:23 pm

cooch wrote:
Mariana Mira wrote:I am trying to construct a design matrix with survival constant in time with only a transient effect in survival. I have read the Mark documentation and I just found how to contruct a design matrix with age effect varying with time. I tryed to construct a design matrix, but the result is not the same as using PIM, so I think that I did something wrong. My design matrix gives the same result as with sex effect (males and females) and not with only transient effect (with no sex effect). Can anybody help me? My PIM for survival look like this for males and females:

1222222
122222
12222
1222
122
12
1


There are at least 2 ways you could approach this problem. But, I'll describe the most flexible. For purposes of this example, assume two groups (say, males and females), with 5 encounter occasions. A priori, we'll assume there is potential for time-variation in phi. We'll assume no variation in p between groups or over time. Assume also we suspect the possibility of 'transients' in the marked samples. So, our PIMS would look like - for males (assume males are the first group in the INP file)

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


and for females

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


Now, the DM corresponding to these PIMs is a bit tricky, but not too bad if you take your time, and pay attention. First, you write out the linear model as

phi = int + sex + age + time + sex*age + sex*time + age*time + sex*age*time.

Next, you need to notice that not all time intervals apply to all TSM classes in the model (discussed in detail in Chapter 8). I've added some blank columns to make the sections more obvious.

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


Column 1 is the intercept, column two codes for sex, column three age (where 1's indicate first TSM class), columns 4-6 time intervals (pay attention to the coding here), column 7 is the S*A interaction, columns 8-9 are the A*time interactions (again, pay attention to which intervals actually have an interaction with age - see Chapter 8), columns 10-12 are the S*time interactions, columns 13-14 are the A*S*time interactions, and column 15 is the encounter rate.

Now, this is a pretty general model, and you can reduce it in a straightforward manner simply be deleting columns. For example, in your original note, you said you wanted constant over time within each TSM class, but different between groups. Easy, simply delete the time columns from the DM, and any interaction columns involving time:


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

This DM constrains your time-dependent PIMS to be entirely equivalent to



Code: Select all
1  2  2  2
   1  2  2
      1  2
         1


and for females

Code: Select all
3  4  4  4
   3  4  4
      3  4
         3


In general, I suggest building the DM for a general, time-dependent model first, then constraining it (i.e., build reduced parameter models) byy adding/deleting/changing columns in this DM. A bit more work up front, but generally worth it in the end.

If you really want the DM corresponding to the time-constant PIMS, for this example it would look like


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


Have another read through both Chapter 7, and Chapter 8. All the preceding is discussed in both chapters, implicitly if not explicitly.


Thanks so much for your detailed answer. But I still have a problem because I want to try another model, the Phi(a2./.) and I don't know how to run this model using the design matrix. I found a linear trend in the recapture parameter, so I need to perform models usind design matrix. I tried to follow the instructions above, performing the full model first and then constraining the model by deleting columns. Then, the columns remaining are column 1 (the intercept) and column two (age), without the columns for time, sex or interactions involving both, since I want to perform a model with constant survival and without sex effect. The only effect that I want to test is the transient effect. But using the aprroach above my design matrix looks like this (using your example above with 5 ocasions and constant recapture):
Code: Select all
110
110
110
110
100
100
100
100
100
100
100
100
100
100
001


I run the model with this desing matrix and the AIC and the parameter values was close to the same model using PIM, but it was not the same. Actually, the diference of the AIC's was 3,00 (not too close). So, I tried the following design matrix:
Code: Select all
11
10
01

But, this is the same as testing sex effect and I don't get the transient effect but the sex effect.
I understand that the column for transient effect is not simetric, but the part coding for the first TSM class have one more occasion than the second TSM class. But I don't know how to buid a desing matrix that reflect a transient effect and constant survival without sex effect. If Cooch or anybody else could help me to construct a design matrix reflecting the PIMs bellow:
for males:

Code: Select all
1222
 122
  12
   1

and for females:

Code: Select all
1222
 122
  12
   1

I would really apretiate!
Mariana Mira
 
Posts: 11
Joined: Thu Mar 01, 2007 10:25 am
Location: Brasília, Brasil

Re: Design Matrix for transients

Postby cooch » Sun Apr 27, 2008 8:26 am

Thanks so much for your detailed answer. But I still have a problem because I want to try another model, the Phi(a2./.) and I don't know how to run this model using the design matrix.


This is the model I've presented in my earlier answer - twice!

I found a linear trend in the recapture parameter, so I need to perform models usind design matrix.


Linear trends using a simple regression-type approach are discussed in Chapter 7 (7.8.1), and various other places.

I tried to follow the instructions above, performing the full model first and then constraining the model by deleting columns. Then, the columns remaining are column 1 (the intercept) and column two (age), without the columns for time, sex or interactions involving both, since I want to perform a model with constant survival and without sex effect. The only effect that I want to test is the transient effect. But using the aprroach above my design matrix looks like this (using your example above with 5 ocasions and constant recapture):


The DM for a 5 occasion study with 2 age classes, corresponding to a2(./.) is exactly what I showed in my first answer:

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


The first column is the intercept, the second column is males or females, the third column is TSM class, the fourth column is the sex*age interaction.

If you want no sex effect, simply delete the sex and sex*age interaction columns. I'll leave it to you to figure out how to put a trend in place - again, read the relevant sections in Chapter 7.
cooch
 
Posts: 1654
Joined: Thu May 15, 2003 4:11 pm
Location: Cornell University

Re: Design Matrix for transients

Postby Mariana Mira » Sun Apr 27, 2008 9:34 pm

Thank you very much! I used your instructions correctly and now it worked very well. In my previous effort the mistake was that I had tried the following desing matrix:
110
110
110
110
100
100
100
100
100
100
100
100
100
100
001

But the correct one is:
110
110
110
110
100
100
100
110
110
110
110
100
100
100
001

Note that the diference is in the second column accounting for transients, I thought that if I deleted the column for sex I would have to put zeros in the 1's of the bottom part fo the column. Thank you so much for help me to see my mistake.
Mariana Mira
 
Posts: 11
Joined: Thu Mar 01, 2007 10:25 am
Location: Brasília, Brasil


Return to analysis help

Who is online

Users browsing this forum: No registered users and 4 guests