Plotting correlation between covariate and psi/p

questions concerning analysis/theory using program PRESENCE

Plotting correlation between covariate and psi/p

Postby Sarah_Walker » Sat Sep 03, 2022 1:19 pm


Im not sure this is the right place to ask this question but I am struggling to find the answers elsewhere. I am wanted to visualise the relationship between the covariates and occupancy/detection through a regression graph. I am doing my masters thesis and have noticed that this is included a lot in previous works, but cannot suss out which data has been plotted or how it needs to be set up.

Apologies if my question is not clear, I will try to clarify better if needed.

Thank you,
Posts: 2
Joined: Sat Aug 20, 2022 11:50 am

Re: Plotting correlation between covariate and psi/p

Postby darryl » Sat Sep 03, 2022 6:15 pm

Hi Sarah
You need to create such graphs outside of PRESENCE, using R or Excel (for example).
Posts: 488
Joined: Thu Jun 12, 2003 3:04 pm
Location: Dunedin, New Zealand

Re: Plotting correlation between covariate and psi/p

Postby jhines » Tue Sep 06, 2022 12:19 pm

Here's an example using RPresence.

Code: Select all
rm(list=ls()); library(RPresence)

# generate simulated value data for single-season model with covariates
data=genpresSD(N=500, K=4,
               cov=TRUE,     # set to true to generate covariates
               psi=c(1, 2),  # beta values for psi : psi=exp(1+2*cov)/(1+exp(1+2*cov))
               p=c(-.5, 1))  # beta values for p: p=exp(-.5+1*cov)/(1+exp(-.5+1*cov))
#  note: unit covariate name will be "ucov" and values from std. normal distribution
#        survey covarite name is "scov" with range similar to ucov
#  create pao file
pao=createPao(data$hst,          # detection-history data
              unitcov=data$ucov,   #  unit(site) covariate data
              survcov=as.vector(unlist(data$scov))) # survey covariate data)

#  run standard single-season model with psi a function of unitcov
#    and p a function of survey covariate
m1=occMod(model=list(psi~ucov, p~survcov),data=pao)

#  create sequence of site covariate values from -2 to 2
newcov = data.frame(ucov=seq(-2,2,.1))
#  get predicted psi values for those covariate values
psi = predict(m1, newdata=newcov, param='psi')

#  plot psi versus range of site covariate values
#  with 95% confidence intervals
plot(x=newcov$ucov, y=psi$est, type='l', main='psi with 95% conf. intervals')
lines(x=newcov$ucov, y=psi$lower_0.95, lty=2)
lines(x=newcov$ucov, y=psi$upper_0.95, lty=2)

Posts: 573
Joined: Fri May 16, 2003 9:24 am
Location: Laurel, MD, USA

Return to analysis help

Who is online

Users browsing this forum: No registered users and 1 guest