### unique time covariates in nest survival model

Posted:

**Fri Oct 29, 2021 5:00 pm**
by **ajudel**

Hi! I am modeling duckling survival using nest survival in RMark. I am struggling with how to add time varying covariates (daily rainfall and daily minimum temperature) to my model. These covariates differ for each individual because they were marked in different years. How can I add these time covariates and have them be unique for each individual? Doing so is straight forward using known fates but I haven't had any success finding a way to do this with nest survival. Any advice would be much appreciated!

### Re: unique time covariates in nest survival model

Posted:

**Fri Oct 29, 2021 6:20 pm**
by **jlaake**

Easiest thing to do is to use year as a group variable such that everything in the group will have the same rainfall and temperature variables across time. Then use merge_design.covariates to add the variables to the ddl$S. Here is an example using the mallard data set in RMark. My example with the precip variable isn't useful because it is the same value for each time but it was quick and dirty. You can read in a dataframe into R with all of the values rather than constructing like I did here.

- Code: Select all
`library(RMark)`

data(mallard)

mallard$habitat <- as.factor(mallard$habitat)

mallard.pr <- process.data(mallard,

nocc=90,

model="Nest",

groups=("habitat"))

ddl=make.design.data(mallard.pr)

df=data.frame(precip=1,group="Native",time=1:89)

df=rbind(df,data.frame(precip=2,group="Wetland",time=1:89))

df=rbind(df,data.frame(precip=3,group="Planted",time=1:89))

df=rbind(df,data.frame(precip=3,group="Roadside",time=1:89))

merge_design.covariates(ddl$S,df,bygroup=TRUE,bytime=TRUE)

ddl$S=merge_design.covariates(ddl$S,df,bygroup=TRUE,bytime=TRUE)

mark(mallard.pr,ddl,model.parameters=list(S=list(formula=~precip)))