Page 1 of 1

R_SECR Within and Between Session Modelling

PostPosted: Fri Jul 01, 2011 6:55 pm
by bgerber
I am having difficulty in coming up with the syntax for constraining parameters (D,g0, sigma....) between sessions. I would gratefully appreciate it if someone could provide a few examples on what the syntax needs to be. My sessions are simply named, 1,2,3,4,5,6. How would I run secr.fit to constrain g0 and sigma for all sessions, but density varies for each session?

Thank You
Sincerely, Brian

Re: R_SECR Within and Between Session Modelling

PostPosted: Sat Jul 02, 2011 9:13 am
by bgerber
Sorry, let me clarify my question more exactly. I am interested in the syntax for constraining some but not all sessions for a given parameter.

For example, how do I change the model specification where Sessions 1-3 have D constrained to be equal and then Sessions 4-6 have their D constrained to be equal.

model <- secr.fit (capthist, model=list(D~1,g0~1,sigma~1), detectfn=0, CL=FALSE)

Sincerely, Brian

Re: R_SECR Within and Between Session Modelling

PostPosted: Mon Jul 04, 2011 2:40 pm
by howeer
I think you need to create a session covariate (see sessioncov argument of secr.fit) and assign the same value to all sessions for which you'd like to constrain density to be equal. Using letters rather than numbers for the different levels of this covariate may help R recognize it as a factor and not a continuous covariate.

For example, create the following dataframe, named sesscovs, in R:
sess sesscov1
1 a
2 a
3 a
4 b
5 b
6 b

then specify that D depends on that covariate, e.g.

model <- secr.fit(capthist, model=list(D~sesscov1, g0~1, sigma~1), detectfn=0, CL=FALSE, sessioncov = sesscovs)

This should give you 1 estimate of each of g0 and sigma, and 2 estimates of density, one for each level of sesscov1.

Good luck,
Eric

Re: R_SECR Within and Between Session Modelling

PostPosted: Tue Jul 05, 2011 11:07 am
by murray.efford
Brian

To see Eric's suggestion working, try this with the 5-session (year) ovenbird example dataset (using some defaults):

secr.fit(ovenCH, buffer = 300, model = D~ab, sessioncov = data.frame(ab = c('a','a','b','b','b')))

One density is estimated for the first two years and another for the last three. You could also use ab = factor(c(1,1,2,2,2)).

Murray