Page 1 of 1

RPresence: Adding a Quadratic Term to occMod

PostPosted: Tue Jan 15, 2019 7:38 pm
by klhefty
Hello!

I'm running single-species, single-season models using RPresence and would like to incorporate quadratic terms into my models. I've attempted to run models using the following structure for a quadratic term:

mod1<-occMod(model = list(psi~distcov+(distcov^2), p~1), data=data, type="so")

However, the resulting model estimates seem to discard the quadratic term I've tried to force and only report the linear term. Is there another way I can code for a quadratic term or do I have to manually generate the quadratic term and add it to my dataframe of covariates? Thank you!

Re: RPresence: Adding a Quadratic Term to occMod

PostPosted: Tue Jan 15, 2019 8:26 pm
by darryl
This is a general R issue, for defining formulas.

Yes, you can manually calculate the quadratic term in your data frame as one option.

To create the quadratic 'on the fly' you have to use the I() function within the formula, i.e., psi~discov+I(distcov^2). This can look messy so some prefer the manual option.

However, you don't need the I() function if you want to use the log() or sqrt() of a covariate, e.g., psi~sqrt(discov) should work fine.

Hope that helps.

Cheers
Darryl