RMark: Constraining with "real" covariates

Posted:
Thu Aug 13, 2009 9:45 pm
by Joana
Hello again,
I have 4 groups (ponds) and I'm trying to constrain survival and recapture on each pond with abiotic factors such as shading or aquatic vegetation and this is what I did:
>alytes.process=process.data(alytes,model="POPAN",time.intervals=c(1,3,0.86,0.57,2.14),groups="pond")
>alytes.ddl=make.design.data(alytes.process)
>df=data.frame(group=c(rep("31",310),rep("32",540),rep("30",140),rep("33",225)),time=rep(c(1:5),243),shading=c(rep("0.3",310),rep("0.07",540),rep("0",140),rep("0.2",225)))
>merge.design.covariates(alytes.ddl$Phi,df,bygroup=T)
Error in merge.design.covariates(alytes.ddl$Phi, df, bygroup = T) :
df does not contain a time value for each time in design data
"31","32","30","33" refer to the 4 ponds' "name"...I don't understand what I'm doing wrong and would very much appreciate if someone would help me...
Thanks,
Joana

Posted:
Thu Aug 13, 2009 11:51 pm
by jlaake
Joana-
Based on the time.interval your times are 0,1,4,4.86 etc rather than 1 to 5.. Also you only need to provide one record in the dataframe per time per group and it will fill in all the design data. Since the covariate is for Phi the value for time is the time at the beginning of the time interval. So if begin.time=0, then you would use 0 for the first interval, 1 for the second interval, 4 for the third interval, etc. But it is the time values rather than a count of occasions.
Hope this helps. --jeff

Posted:
Sat Aug 15, 2009 8:45 pm
by Joana
Hi Jeff,
Thanks for your help.
I have another question: after defining the parameters with the corresponding variables, creating the model list and using mark.wrapper, the results don't include every possible model with the defined parameters...again, what am I missing?
Thanks and sorry for being a n00b...
Joana

Posted:
Sun Aug 16, 2009 11:16 pm
by jlaake
It would have issued an error but you most likely didn't see it amongst the output summaries for the models that did run. Use run=FALSE with mark.wrapper and run the code and it will build each model but won't run them. Then you can see the error message. There is a list of error messages at the end of the Appendix material. if t is not in there or you can't figure it out let me know but I'll have to see the error to give you any suggestions as to what is wrong. --jeff

Posted:
Fri Aug 21, 2009 2:11 am
by FroggyDew
If some models are not run, it might be due to some variables being declared as factors in the formulas. It just happened to me today...

Posted:
Fri Aug 21, 2009 9:56 am
by jlaake
That is a possibility but I think all of her covariates are in the design data. Factor variables are ok in the design data but not as individual covariates because for the latter the name of the covariate is put in the DM and MARK fills in the value to compute the parameters for each animal. For many factor varianbles this would not make sense because the factor levls would be treated as a numerical covariate. You can use factor variables as individual covarates if you create k-1 dummy (0/1) numeric variables for a k-level factor variable but typically it ibetter to use factor variables to define groups.
regards --jeff

Posted:
Fri Aug 21, 2009 10:08 am
by cooch
jlaake wrote:You can use factor variables as individual covarates if you create k-1 dummy (0/1) numeric variables for a k-level factor variable but typically it ibetter to use factor variables to define groups.
regards --jeff
Actually, I think Jeff meant you can use individual covariates as factor variables (k-1 dummy variables for a k-level factor group). This is discussed in some detail in section 11.7 of chapter 11 in 'the book'.