by murray.efford » Mon Nov 15, 2010 11:28 pm
Tom
It's possible to code sex as a continuous individual covariate as you have done, but in Density it is simpler and faster to treat groups such as males and females as separate 'sessions' (see Session in the Help index). For this you would replace your first column of '1's with your sex codes (1/2 or F/M):
2 2 52 A_41
1 3 16 A_75
1 3 23 A_97
1 3 23 A_26
1 6 51 A_66
2 7 31 A_77
2 7 38 A_92
2 8 1 A_113
Then you specify sex-specific models with the 'Between-session model'
tab in Options | ML SECR, choosing 'Session' as the 'constraint'
(double-clicking in the cell will do it). Run the model with 'GO All'.
The table of parameter estimates in the Log will include separate
estimates for each session (= sex).
I hope this is enough to get you going. Using the 'session' method can become messy if you also want to compare areas or times.
As an aside, all this is handled more cleanly in the R package 'secr', and it's easy to combine effects and compare models. In the following example we add a 'made-up' sex covariate to one of the demonstration data sets.
library(secr)
data(secrdemo) ## includes test data 'captdata'
madeupsex <- sample(c('F','M'), size=nrow(captdata), p=c(0.5,0.5), replace=T)
covariates(captdata) <- data.frame(sex = factor(madeupsex))
temp <- secr.fit(captdata, model = list(g0 ~ sex, sigma ~ sex), CL = T, trace = F)
predict(temp, new = data.frame(sex = c('F','M')))
$`sex = F`
link estimate SE.estimate lcl ucl
g0 logit 0.3076745 0.04150554 0.2327378 0.3943386
sigma log 30.1180428 1.83924256 26.7235474 33.9437160
$`sex = M`
link estimate SE.estimate lcl ucl
g0 logit 0.2442329 0.03596636 0.1807146 0.3213208
sigma log 28.7524848 1.75585094 25.5118965 32.4047013
## As we used conditional likelihood (CL = T), density is a 'derived' parameter
## We ask for it to be computed for groups defined by the 'sex' covariate
derived(temp, groups = 'sex')
$F
estimate SE.estimate lcl ucl varcomp1 varcomp2
esa 14.389646 NA NA NA NA NA
D 2.571293 0.4339077 1.851475 3.570963 0.1786905 0.009585403
$M
estimate SE.estimate lcl ucl varcomp1 varcomp2
esa 13.413020 NA NA NA NA NA
D 2.907623 0.4775929 2.111801 4.003345 0.2167761 0.01131885
Murray