Coding site-level covariates that vary by year

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

Re: Coding site-level covariates that vary by year

Postby DMNH » Sat Aug 03, 2019 10:57 am

Hi Jim,
I have still been unable to enter site-level covariates that differ by year. I have tried using the code in a previous post, but replacing the 'rbind' function with 'cbind' and still have not been successful. Here is the code I used:
Code: Select all
eps.cov<-data.frame(HabYear=cbind(habcov[,3],habcov[,4],habcov[,5],habcov[,6]))

mod<- occMod(model=list(psi~1, gamma~1,epsilon~HabYear, p~1),data= EAME.pao, type= "do.1",cov.list=list(eps.cov=eps.cov))
I receive the error:
"Error in eval(predvars,data,env): object 'HabYear' not found

I have also tried creating the data.frame from the matrix as an alternative and have not had any luck.

Any advice would be appreciated.
Thank you,
Devin
DMNH
 
Posts: 4
Joined: Fri Apr 19, 2019 2:13 pm

Re: Coding site-level covariates that vary by year

Postby darryl » Sat Aug 03, 2019 10:05 pm

Hi Devin,
You need to use rbind, or even just use c() if you have the one variable, so that HabYear is a single variable of length (T-1)*nunits in the data.frame, not cbind. Check the names of the variables in data.frame after you've made it (ie names(eps.cov)).
Cheers
Darryl
darryl
 
Posts: 477
Joined: Thu Jun 12, 2003 3:04 pm
Location: Dunedin, New Zealand

Re: Coding site-level covariates that vary by year

Postby DMNH » Wed Aug 07, 2019 3:10 pm

Hi Darryl
Using c() did the trick and I was able to pass it through to occmod(). Thank you very much.

I am also wondering how to go about doing the same thing for detection. While the surveys were being being performed they provided the surveyors with maps that had where the species were detected in the previous year and I wanted to see if that influenced detection. I tried using the same methods mentioned above, but received the error:

Error in `.rowNamesDF<-`(x, value = value) : invalid 'row.names' length

Would it make sense to include it as a survey covariate? I would have to make all surveys within a year have the same value. I'm just not sure if this would be violating any assumptions or if there is an easier way to do this.

Thank you,
Devin
DMNH
 
Posts: 4
Joined: Fri Apr 19, 2019 2:13 pm

Previous

Return to RPresence

Who is online

Users browsing this forum: No registered users and 1 guest