can i use time as a covariate in covariate.predictions?

posts related to the RMark library, which may not be of general interest to users of 'classic' MARK

can i use time as a covariate in covariate.predictions?

Postby rmark4salamanders » Mon Mar 27, 2017 11:33 am

my question is similar to this one from 2014:
http://www.phidot.org/forum/viewtopic.php?f=21&t=2864&p=9117&hilit=covariate.predictions+include+time#p9117

I have a time varying individual covariate for body size (which has been assumed for the capture occasions when animals were not observed, given what we know about growth rates), and i would like to use covariate.predictions to estimate a survival rate for each of 4 possible body sizes at each sampling occasion.

My model says S~size+time, and I have tried writing covariate.predictions like this:

Code: Select all
   predS1 <- covariate.predictions(modT1,data=data.frame(index=rep(c(1),148),
      t1.1=c(t.values),siz1.1=rep(c(size.values),each=37)))


where t.values is a list of my sampling occasions (I have irregular length intervals, hence why the occasion names have gaps int he sequence) which looks like this:

Code: Select all
   t1.1
1   1.1
2   2.1
3   7.1
4   8.1
5   9.1
6  10.1
7  11.1
8  12.1
9  13.1
10 14.1
11 15.1
12 20.1
13 21.1
14 22.1
15 23.1
16 24.1
17 26.1
18 34.1
19 35.1
20 36.1
21 37.1
22 38.1
23 39.1
24 40.1
25 47.1
26 48.1
27 49.1
28 50.1
29 51.1
30 52.1
31 53.1
32 61.1
33 63.1
34 66.1
35 74.1
36 76.1
37 79.1


and size.values looks like this:

Code: Select all
[1] 2 3 4 5


The function will produce predictions, but within a particular size class, all predictions are the same regardless of time.

I have also tried creating a covariate to index time, where each sampling occasion was given a number from 1 to 37 and then standardized, and S~size+timeindex. This method does produce a unique prediction for each size class at each occasion, but when i graph these values, they are clearly highly correlated with one another, so if body size 2 has S=0.5 at time 1, then body size 3 has S=0.6, and body size 4 has S=0.7, and so on, they are not varying independently of one another.

So i'm wondering if there is a way to use time, as the "Robust" model defines it in RMark, in covariate.predictions to remedy this problem.

Thanks!
rmark4salamanders
 
Posts: 8
Joined: Wed Apr 20, 2016 12:48 pm

Re: can i use time as a covariate in covariate.predictions?

Postby jlaake » Mon Mar 27, 2017 12:04 pm

My model says S~size+time, and I have tried writing covariate.predictions like this:

CODE: SELECT ALL
predS1 <- covariate.predictions(modT1,data=data.frame(index=rep(c(1),148),
t1.1=c(t.values),siz1.1=rep(c(size.values),each=37)))



You have chosen to use the same index value for each prediction. The index value refers to a row in the design data(design matrix) so it is no surprise that there isn't a time difference. Also, in the dataframe you have used siz1.1 instead of the actual covariate names used in the model which would be sizexx with xx being a suffix for the time varying covariates. Look in your design matrix to see what names are used and use those names in your dataframe and specify the values. This problem comes up routinely and I don't understand why. I thought it was fairly clear in the documentation and workshop notes. All the code does is plug in values for covariates by matching via the names used in the DM. You can just use any names you want and expect it to match correctly.

You also have a fairly simple model, so you can also choose to use the plogis function in R with the estimated coefficients and the covariate values to compute the predicted values.

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

Re: can i use time as a covariate in covariate.predictions?

Postby rmark4salamanders » Mon Mar 27, 2017 3:13 pm

Perhaps i should have been more exact in writing out the model, siz is actually the name of the size covariate, i wrote it as size in describing how i defined S to be more clear, but clearly that didn't work out.

the part about the index makes sense, I took that code from a prediction script i made for a model that didn't vary with time, in which case using the same index works out fine.

thanks for your help.
rmark4salamanders
 
Posts: 8
Joined: Wed Apr 20, 2016 12:48 pm


Return to RMark

Who is online

Users browsing this forum: No registered users and 9 guests