Estimation problems in multi-session analysis

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

Estimation problems in multi-session analysis

Postby jcusack » Sun Aug 07, 2011 11:59 am

Hello,

This should be a relatively simple question but I have been struggling with it. I have a capthist object with 4 different sessions (each composed of 7 occasions), imported as required using a vector of trapfiles (one for each session):

RSData<-read.capthist(captfile="RSdata_LoggedForest.txt",trapfile=c("E1_RSTrapdata_Session1.txt","E2_RSTrapdata_Session2.txt","F1_RSTrapdata_Session3.txt","F2_RSTrapdata_Session4.txt"),detector="single")

When I inspect my data (summary) everything seems to be fine and all the sessions have been appropriately specified. However, when I try and run a simple model looking at density as a function of session, secr.fit returns the following output:

>RSsecr<-secr.fit(RSData,model=list(D~session,g0~1,sigma~1))
>RSsecr

secr.fit( capthist = RSData, model = list(D ~ session, g0 ~ 1, sigma ~ 1),
buffer = 50 )
secr 2.1.0, 15:47:17 07 Aug 2011

$`1`
Object class traps
Detector type single
Detector number 96
Average spacing 6.546681 m
x-range 876193.7 876324.4 m
y-range 521046.5 521316.3 m

$`2`
Object class traps
Detector type single
Detector number 96
Average spacing 7.640513 m
x-range 876302 876435 m
y-range 521490.1 521759.1 m

$`3`
Object class traps
Detector type single
Detector number 96
Average spacing 8.101695 m
x-range 871723.2 871813.8 m
y-range 520921.8 521185.1 m

$`4`
Object class traps
Detector type single
Detector number 96
Average spacing 7.708401 m
x-range 871764.1 871861 m
y-range 520466.6 520731 m

1 2 3 4
Occasions 7 7 7 7
Detections 72 57 78 57
Animals 29 26 36 28
Detectors 96 96 96 96

Model : D~session g0~1 sigma~1
Fixed (real) : none
Detection fn : halfnormal
Distribution : poisson
N parameters : 6
Log likelihood : -1e+10
AIC : 2e+10
AICc : 2e+10

Beta parameters (coefficients)
beta SE.beta lcl ucl
D 2.255436 NA NA NA
D.session2 0.000000 NA NA NA
D.session3 0.000000 NA NA NA
D.session4 0.000000 NA NA NA
g0 -1.714053 NA NA NA
sigma 2.494075 NA NA NA

Variance-covariance matrix of beta parameters
NULL

Fitted (real) parameters evaluated at base levels of covariates

session = 1
link estimate SE.estimate lcl ucl
D log 9.5394563 NA NA NA
g0 logit 0.1526388 NA NA NA
sigma log 12.1105241 NA NA NA

session = 2
link estimate SE.estimate lcl ucl
D log 9.5394563 NA NA NA
g0 logit 0.1526388 NA NA NA
sigma log 12.1105241 NA NA NA

session = 3
link estimate SE.estimate lcl ucl
D log 9.5394563 NA NA NA
g0 logit 0.1526388 NA NA NA
sigma log 12.1105241 NA NA NA

session = 4
link estimate SE.estimate lcl ucl
D log 9.5394563 NA NA NA
g0 logit 0.1526388 NA NA NA
sigma log 12.1105241 NA NA NA

It seems secr.fit is unable to estimate loglik properly and only considers the first session, even though it acknowledges the existence of 4 distinct sessions.
If someone could point out what I am doing wrong it would be really helpful! Sorry if this is obvious.

Many thanks!
Jeremy
jcusack
 
Posts: 2
Joined: Mon Aug 01, 2011 9:28 am

Re: Estimation problems in multi-session analysis

Postby murray.efford » Sun Aug 07, 2011 12:51 pm

Jeremy
I think there's something more fundamental wrong here. I have a hunch, but would really need to look at your data to check it. If you're OK with that then please send to me offline. Thanks
Murray
murray.efford
 
Posts: 686
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand

Re: Estimation problems in multi-session analysis

Postby murray.efford » Mon Aug 08, 2011 10:36 am

Jeremy

These points follow some fossicking around in your data, but have general interest so I post them here.

1. secr.fit failed to fit the model at all and just returned the initial values. This was obvious from the NA values output for the likelihood at each step during fitting, the missing variance-covariance matrix etc.
2. My first thought related to starting values. The default algorithm is to compute an approximation for g0 and sigma from the first session, and apply it across all sessions. This can fail if the sessions are very different, and in fact I was able to at least compute the likelihood with manually provided 'start' values. However, the model still failed to fit properly (no var-covar matrix). So there is some numerical issue in the likelihood maximisation.
3. In Density the model fits fine (using a different maximisation algorithm).
4. That leaves the choice of tweaking the secr.fit algorithm so that it works (options may be passed to nlm etc.), or looking for the feature of the data that makes the fit unstable.
5. Reviewing the data in Density, with 'Show tracks' on, revealed a single extreme movement in session 3 (from 3 0417818359 3 199) that is wildly improbable with the sigma we ultimately estimate and a halfnormal detection model. This may be a data error, or an unusual movement. Comment out that data line (#) and the model fits fine. Even just fitting a detection function with a longer tail (e.g., neg exponential detectfn=2) gets you part way there - automatic start values OK, but still no var-covar matrix.

There may be some lessons in here for the software developer (a better indication when model fitting fails?), but I'm afraid there will always be numerical hazards.

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

Re: Estimation problems in multi-session analysis

Postby emma.s » Sat Sep 02, 2017 2:12 pm

Hi Murray,

This probably unrelated to the issue above but it is multi-session problem. I have a multi-session capthist and I wanted to fit models that vary with session. The capthist consists of 12 sessions with varying occasions. I ran the following model below and there were no errors

secr.fit(capthist, model = list(D~session, g0~1, sigma~1), detectfn=0, mask=j.mask, method = "Nelder-Mead",
details = list(autoini = 2), CL = TRUE)
No errors on this.
secr.fit(capthist, model = list(D~session, g0~session, sigma~1), detectfn=0, mask=j.mask,
method = "Nelder-Mead", details = list(autoini = 2), CL = TRUE)
At the end (after the run was complete) I got the following warning message:
In secr.fit(jag.chist.lev, model = list(D~session, g0~session, :
Probable maximization error: optim returned convergence 1. See ?optim

Is there a problem with the syntax of the model? I included CL = TRUE so that I can combine individual covariates (sex and residency; D~session+sex) and make the models comparable for AIC. Given "probable maxmimization error" should CL = FALSE? Total newbie here so I maybe be applying things wrongly.

I'd appreciate any recommendations.

Cheers
ES
emma.s
 
Posts: 4
Joined: Thu Mar 16, 2017 5:14 pm

Re: Estimation problems in multi-session analysis

Postby murray.efford » Sat Sep 02, 2017 5:49 pm

Hi Emma

I don't have any special insight on this. You've added 11 more parameters to estimate, and it looks like there is a problem estimating them all (i.e. lack of identifiability). Perhaps the fact that you have (legitimately) resorted to "autoini = 2" indicates too few data in session 1 (and others?).

The first model fit should not have worked, because no model can be fitted for D when CL = TRUE. Whatever this did, it did not fit a session-specific density model.

If you really want to model session-related variation in g0 I would suggest finding a session-level covariate that captures that variation, rather than simply going for a unique g0 in each session. That way you would need fewer parameters and could dodge data inadequacy in one or two sessions. Even try just grouping sessions (...sessioncov = data.frame(gp = c(1,1,1,2,2,3,3,3,3,4,4,4)), model = g0~gp...).

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

Re: Estimation problems in multi-session analysis

Postby emma.s » Sat Sep 02, 2017 8:08 pm

Thank you for the advice. I did think about doing the sessioncov instead but I was not completely sure. I did the shareFactorLevel function and autoini because the first session was male captures only. When I tried running the models it would say something like unequal covariates...(eg D~sex).

My other option was to actually join consecutive sessions to make it into 6 sessions instead. That way I don't have the unequal sex covariate and I would likely have more captures per session. What do you think about this?
I am still inclined in using the session covarites for session. Would this be a better option?

Thanks again for the recommendations.

ES
emma.s
 
Posts: 4
Joined: Thu Mar 16, 2017 5:14 pm


Return to analysis help

Who is online

Users browsing this forum: No registered users and 3 guests