Multi-state, multi-stage nest survival

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

Multi-state, multi-stage nest survival

Postby csetash » Thu Mar 23, 2017 4:00 pm

I am trying to fit a multi-state, multi-stage model for nest survival (sensu Miller et al. 2017) for a species of duck and I can’t figure out what I’m doing wrong when it comes to covariate.predictions().

I have 5 states: 1=alive at laying, 2=alive at incubation, 3=dead during laying, 4=dead during incubation, 5=hatched (and therefore no longer monitored).

I’ve fixed all the biologically infeasible transitions to 0 and fixed S and p to 1. I have also created a time-varying covariate for time-to-hatch for the 2->5 transition since its probability of transitioning should increase the closer the nest gets to estimated hatch date. I also included a quadratic term for this (like they did in the paper) so the probability of hatching can decrease once the estimated hatch date has been surpassed (e.g. for inviable nests).

When I run the following model:

S.stratum <- list(formula =~ 1, link="sin")
p.stratum <- list(formula =~ 1, link="sin")
Psi.test <- list(formula =~ 1 + stratum:tostratum + my25:hatch + my25:hatchsq + to3:robel + to4:robel +to4:water)

test.model <- mark(mstrata.processed, mstrata.ddl,
model.parameters=list(S = S.stratum, p = p.stratum, Psi = Psi.test),
mlogit0=TRUE, hessian=TRUE)

with the vegetation height (robel) and distance to water (water) modeled on the mortality transitions and the two time-to-hatch covariates modeled on the hatching transition, everything seems to work and all of my betas have SE estimates (which was a problem when I tried more complicated models; thus the use of “hessian=TRUE”).

However, when I run

Psi13.robel<-covariate.predictions(test.model,
data=data.frame(robel.values),
indices=c(1:66600),
drop=TRUE)

and include all of the indices for every psi parameter from the all-different PIMS (1:66600), I get an error saying “cannot allocate a vector of size 5387.6 Gb.” Something must be storing improperly or it’s a problem with my data, but I can’t figure out why this would be so large. Any help would be greatly appreciated!
csetash
 
Posts: 2
Joined: Thu Mar 23, 2017 3:33 pm

Re: Multi-state, multi-stage nest survival

Postby jlaake » Thu Mar 23, 2017 4:48 pm

You need to read the help for covariate.predictions and the workshop notes closely. You have asked it to compute 66600*length(robel.values) values which I don't know how long that is. With the way you have it structured it will compute a value for index=1 and each value in robel.values, then for index=2 etc. If you include index in the data.frame then it matches a specific robel.value to a specific index but not sure what you are doing here. Also as it says in the documentation the names in the dataframe have to match the names of the values used in the formula. Your variable in the formula is robel so it should say data=data.frame(robel=robel.values). Without linking robel to the values it doesn't know what variable the covariate values apply to.
jlaake
 
Posts: 1417
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: Multi-state, multi-stage nest survival

Postby csetash » Thu Mar 23, 2017 5:51 pm

Thanks for the speedy response!

I created a sequence of possible robel values with the following code:

robel.min<-min(my.data$robel)
robel.max<-max(my.data$robel)
robel.values<-seq(from=robel.min, to=robel.max, length=150)

So that's why the name of the variable is different from the formula. This would mean it's multiplying indices 1:66600 x each of the 150 possible values for "robel" if I'm understanding you correctly. That makes sense, thanks.

I still don't think I understand whether I should include "index" in the data.frame or as its own argument:

jlaake wrote:If you include index in the data.frame then it matches a specific robel.value to a specific index but not sure what you are doing here.


I essentially want to know what my Psi13 estimates (indices 1:66600) would be for every value of "robel" possible. When I use the indices argument, it's indexing all of the Psi13 parameters. Since these parameters are constant, I only want to index 1 of them to see how it would change over the range of robel values. So does that mean I should use "index" in the data.frame argument? This shouldn't work, however, because this index has to be the same length as robel.values=150. Following that logic, should I just index 150 of the Psi13 parameters within the data.frame argument to estimate how Psi13 changes over 150 possible robel values?

Thanks again for all of your help, I really appreciate it.
csetash
 
Posts: 2
Joined: Thu Mar 23, 2017 3:33 pm


Return to RMark

Who is online

Users browsing this forum: Google [Bot] and 9 guests

cron