Trap-specific beta coefficients

questions concerning anlysis/theory using program DENSITY and R package secr. Focus on spatially-explicit analysis.

Trap-specific beta coefficients

Postby crk5121 » Fri Feb 10, 2017 11:58 am

I am using secr to assess density of an herbivore using trail cameras. I expect the detection of animals to vary among trap locations based on a "frac_m" covariate (which has a different value for each trap location). I defined this trap-covariate in read.capthist() and verified it's definition using covariates(trap()), where it properly showed the frac_m value for each trap location. I ran secr.fit() with frac_m influencing g0 and sigma, and expected an output of beta coefficients for each location based on their values of frac_m. Am I misunderstanding secr's use of detection covariates? Is there a proper way to obtain beta coefficients for this effect?

DeerCH <- read.capthist('Indiv_All.txt', 'SECR_Input.txt', detector='count',
covnames=c("GpSz", "Sex"), trapcovnames="frac_m")
covariates(traps(DeerCH))
secrDeerg0sigfm <- secr.fit(DeerCH, model=c(g0~frac_m, sigma~frac_m), trace=FALSE)

Beta parameters (coefficients)
beta SE.beta lcl ucl
D 0.1402256 0.1148725 -0.08492031 0.3653716
g0 0.6781673 0.2984780 0.09316110 1.2631734
g0.frac_m -7.3820955 0.7526339 -8.85723096 -5.9069601
sigma 5.3144099 0.3335357 4.66069190 5.9681280
sigma.frac_m 3.3401357 0.8620058 1.65063531 5.0296360


I greatly appreciate your input!
crk5121
 
Posts: 3
Joined: Fri Feb 10, 2017 11:44 am

Re: Trap-specific beta coefficients

Postby murray.efford » Sat Feb 11, 2017 5:01 am

Hi crk5121

If frac_m is numeric (rather than a factor) then fitting frac_m as a predictor requires one extra beta coefficient, just as a linear regression has one coefficient for slope. The fitted relationship is linear on the link scale (so g0~frac_m fits a linear relationship between g0 and frac_m on the logit scale, unless you have perversely changed the link function; the default link for sigma is 'log').

To evaluate the predicted g0 for each value of sigma you need to provide the values of frac_m in a call to predict. In your case, maybe
Code: Select all
[predict(secrDeerg0sigfm, newdata=data.frame(frac_m = covariates(traps(DeerCH))$frac_m))

However, (i) I haven't of course checked that, (ii) that generates a lot of output you probably don't want, and some further data extraction may be needed with e.g. sapply, and (iii) maybe you just want to plot a curve through a small number of well-spaced points.

As an aside: the code is far from optimal for trap covariates and I'm pleasantly surprised you got this to fit with lots of different values for frac_m: often it seems necessary to discretize a covariate like that so that it doesn't demand so much memory.

Murray
murray.efford
 
Posts: 686
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand

Re: Trap-specific beta coefficients

Postby crk5121 » Tue Feb 14, 2017 8:56 pm

Murray,

Your suggested code is exactly what I needed! It worked beautifully. I will consider using a discrete variable for ease of analysis, but I was able to extract the appropriate beta coefficients.

Thank you so much for your time and input.

Chellby
crk5121
 
Posts: 3
Joined: Fri Feb 10, 2017 11:44 am

Re: Trap-specific beta coefficients

Postby murray.efford » Tue Feb 14, 2017 9:10 pm

Hi Chellby
Glad you made progress. Just to be clear: the values returned by predict.secr are predicted values of 'real' parameters, not 'beta' coefficients. The coefficients are an intercept and a slope on the link scale. See
Code: Select all
coef(secrDeerg0sigfm)
for the coefficients.
Murray
murray.efford
 
Posts: 686
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand

Re: Trap-specific beta coefficients

Postby crk5121 » Thu Feb 16, 2017 2:05 pm

Murray,

Great! Thank you for clarifying.

Chellby
crk5121
 
Posts: 3
Joined: Fri Feb 10, 2017 11:44 am


Return to analysis help

Who is online

Users browsing this forum: No registered users and 10 guests

cron