RPresence: Adding a Quadratic Term to occMod

posts related to the RPresence library, which may not be of general interest to users of 'classic' PRESENCE.

RPresence: Adding a Quadratic Term to occMod

Postby klhefty » Tue Jan 15, 2019 7:38 pm


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!
Posts: 3
Joined: Tue Jan 15, 2019 6:41 pm

Re: RPresence: Adding a Quadratic Term to occMod

Postby darryl » Tue Jan 15, 2019 8:26 pm

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.

Posts: 477
Joined: Thu Jun 12, 2003 3:04 pm
Location: Dunedin, New Zealand

Return to RPresence

Who is online

Users browsing this forum: No registered users and 2 guests