groups

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

groups

Postby vjb » Fri Feb 25, 2011 1:07 am

Hi Murray,
As you know, we’ve been doing mark-recapture trapping for foxes on 18 small grids for 3 years. I've been analyzing each year's data using multisession models, but now I’d like to do a comprehensive analysis, combining all data and considering years as groups. Thus, I included Yr as a categorical covariate in the capthist file (coding years as A, B, and C):

covariates(allyrs)

$`08_01`
Yr
F225 A

$`08_02`
Yr
F312 A
F98 A
M175 A



When I try to run models in which D or g0 vary by year, R crashes. For example, for either:

DyrG1S1g1s1HN <- secr.fit(allyrs,model=list(D~g,g0~1,sigma~1),start=c(-3,-3,-3,-2,5),buffer=2000,groups='Yr',detectfn=0)
D1GyrS1g1s1HN <- secr.fit(allyrs,model=list(D~1,g0~g,sigma~1), start=c(-3,-2,-2,-2,5),buffer=2000,groups='Yr',detectfn=0)


R crashes at this point, on multiple computers:
Checking data
Preparing detection design matrices
Preparing density design matrix
[R for Windows GUI front-end has encountered a problem and needs to close. We are sorry….]


I am able to run these data with Yr as an ind. covariate (e.g. D~Yr) with CL, but groups seem more appropriate. Is there a limitation on design matrix size? (I have 52 sessions total) Or do you see an error I'm making along the way?
Thanks for any assistance, Vickie
vjb
 
Posts: 3
Joined: Fri Aug 22, 2008 4:06 pm

Re: groups

Postby murray.efford » Fri Feb 25, 2011 1:39 am

Hi Vickie

I really can't say what is going on. Groups have not had much attention, and are not part of my usual testing. As Deb found earlier in the week, it is possible to run up against memory limits, but these usually give an explicit error message. I would avoid groups if you can (why not sessions?). It is possible there is a simple bug, and I would be interested to quickly look for the problem if you send data, but anything major would have to wait a few weeks. Might be worth trying 2.0.0 first if you haven't already downloaded it.

[There is an undocumented design issue with groups: I suspect they cannot be used in the full likelihood context exactly as we are used to using them in MARK for CJS etc. (i.e. as if they are individual covariates even tho' we know individual covariates are not allowed with full likelihood). So the secr implementation treats them as hard partitions of the data almost like sessions. However, this doesn't explain your problem.]

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

Re: groups

Postby murray.efford » Fri Feb 25, 2011 3:13 am

Following up on this, I haven't been able to crash secr with >1000 detections of >300 animals in >160 traps with 6 groups - groups are not as shaky as I had feared! The 'groups' argument of secr.fit should be a factor, but you must already have that right. I wonder if the problem is in your 'start' values (you had a reason to specify these?). The beta parameters for group 2 & group 3 should be the difference from group 1 on the relevant link scale. This is not a good reason for it to crash, but might give a clue. Also, foxes that get recaptured in years 2 and 3 should be renumbered uniquely in those years, or you will get in a tangle.
Murray
murray.efford
 
Posts: 686
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand

Re: groups

Postby vjb » Fri Feb 25, 2011 12:52 pm

Thanks for the quick feedback Murray.
1. As for the "Why not sessions?" question, I thought combining years would gain me some power to see behavioral effects or in estimating parameters likely to be fairly constant from year to year (eg sigma) while also allowing session, yr and yr+session type model formulations, but feedback on that is welcome.
2. I don't think start values are the problem -- I tried varying the betas for yr2 and yr3 -- but yes, I see yr2 and yr3 should probably be 0. I don't have enough captures in session 1 so require some manual start values.
3. I suspect the problem again stems from my learning curve with R and so perhaps not forum fodder. I did not specify yr as a factor but that seems to be automatic for an alphanumeric?? But, I'm wondering if the problem is related to the parsing of groups across sessions within the capthist object. For example, covariates(allyrs)$yr is null. Instead, the grouping covariates are assigned to sessions (eg: covariates(allyrs)$'08_01'$yr exists and is.factor=true).
4. Thanks for the heads up on the unique fox ID values needed across years - that would have been my next problem!
Vickie
vjb
 
Posts: 3
Joined: Fri Aug 22, 2008 4:06 pm

Re: groups

Postby murray.efford » Fri Feb 25, 2011 5:07 pm

On your points
1. There are many ways to skin this cat, but one would be to have a 'session' for each combination of year and grid (assuming no significant recaptures between grids) and to use session covariates to define various models (D ~yr, D~yr+grid etc.). Make a separate dataframe with one row for each 'session', one column for each covariate (yr, grid) and pass it as the sessioncov argument of secr.fit. Rebuilding your capthist object might be a challenge - send me an example off-forum if you want help on that.
2. OK
3. Certainly, covariates are defined independently for each session (i.e. within sessions).
4. Not a problem if you follow (1)

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


Return to analysis help

Who is online

Users browsing this forum: No registered users and 10 guests