Page 1 of 1

covariate prediction query

PostPosted: Mon Nov 22, 2010 7:41 am
by geoffwah
Hi All

I was hoping for some guidance regarding the use of the ‘covariate.predictions’ function with single-season occupancy models. I have fit models with different covariate structures for Psi, and want to derive model averaged curves for the relationship between Psi and each of the covariates. For each curve, I want to hold the other covariates at their median values, and this is where I am running into trouble. I can produce model averaged curves for each covariate in which the other covariates are held at their means, simply by excluding values for these covariates in the dataframe (as per the helpfile). However, I can’t quite work how to explicitly set values for the other covariates when deriving each curve.

The models I have fit have additive combinations of a total of six variables for Psi. In all models, the probability of detection is modelled as an additive combination of the same three variables. Thus, my models look like:
> effarea.aqveg.conn=mark(occ_data,model="Occupancy",model.parameters=list(Psi=list(formula=~effarea+aqveg+conn),p=list(formula=~effort+date+night)))

I know there is probably a straightforward means of doing this, and I missing something fundamental. Apologies if so!

Regards

Geoff

Re: covariate prediction query

PostPosted: Mon Nov 22, 2010 11:35 am
by jlaake
The data argument for covariate.predictions is a dataframe, so you can specify the values of any of the covariates. So if you have covariates x,y,z and you want to look at the value of Psi at various values of x while holding y and z at median values you can create a dataframe:

x y z
1 10 12
2 10 12
3 10 12

etc where 10 is median of y and 12 is median of z. By adding the index field to data you can also control which parameters are estimated with specific covariate value sets but in your case that is probably not necessary.

--jeff

Re: covariate prediction query

PostPosted: Mon Nov 22, 2010 11:57 pm
by geoffwah
Hi Jeff

Much thanks, I am now in business! I had previously attempted to do what you instructed, but came a cropper with a slight glitch in my code by the look of things.

Thanks again - really appreciate the help, and the package!

Cheers

Geoff