RMark-like mark.wrapper and create.model.list?

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

RMark-like mark.wrapper and create.model.list?

Postby RJDan » Sat Mar 08, 2014 5:18 pm

Hi
Is there something in secr available similar to the RMark mark.wrapper and create.model.list functions?
It would save a lot of time in setting up models to run.
I've read through most of the R help files and I don't remember seeing anything like this.

Thanks
RJDan
 
Posts: 3
Joined: Sat Mar 08, 2014 3:24 pm

Re: RMark-like mark.wrapper and create.model.list?

Postby murray.efford » Sun Mar 09, 2014 9:39 pm

Not sure quite what you mean or what RMark does, but the next release of secr due out in a few weeks has a function 'par.secr.fit' that runs a list of models simultaneously in parallel on one or more cores. You can already do this yourself on one core if you are comfortable with lapply or mapply and do.call (unlikely!), or just submit a script with multiple calls to secr.fit. Once you have a set of fitted models combine them into an 'secrlist' (for AIC etc.) with the secrlist() function.
Murray
murray.efford
 
Posts: 712
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand

Re: RMark-like mark.wrapper and create.model.list?

Postby RJDan » Mon Mar 10, 2014 3:16 am

Hey
Thanks for the reply!

RMark has two functions; create.model.list() and mark.wrapper() which can be used to run a set of models using a set of parameter specifications without having to specify the exact combination of parameter settings for each model.

For example, instead of running a model using:

### Preping data
newdipper.proc<-process.data(newdipper, model="CJS", groups="sex", begin.time=1990)
newdipper.ddl<-make.design.data(newdipper.proc)

### Specifying parameters using formulae
Phi.dot=list(formula=~1)
p.dot=list(formula=~1)
### Running the model
modela<-mark(newdipper.proc,newdipper.ddl, model.parameters=list(Phi=Phi.dot, p=p.dot))


You could create a list of the model parameter specifications and then use create.model.list to create combinations of Phi and p parameter specifications, each of which would be used for a single model.


# Define range of models for Phi
#
Phi.dot=list(formula=~1)
Phi.time=list(formula=~time)
Phi.sex=list(formula=~sex)
Phi.Flood=list(formula=~Flood)
#
# Define range of models for p
#
p.dot=list(formula=~1)
p.time=list(formula=~time)
p.Flood=list(formula=~Flood)
#
# Run all pairings of models
#
dipper.model.list=create.model.list("CJS")
dipper.results=mark.wrapper(dipper.model.list,
data=dipper.processed,ddl=dipper.ddl)

I hope this makes sense (?).
RJDan
 
Posts: 3
Joined: Sat Mar 08, 2014 3:24 pm

Re: RMark-like mark.wrapper and create.model.list?

Postby murray.efford » Mon Mar 10, 2014 3:30 am

Almost: you don't show the connection between your call create.model.list() and the preceding definitions, but I can imagine it.

I'm not tempted to implement something similar in 'secr' where there are more 'real' parameters, more levels of covariates, different parameterizations, and each model fits more slowly. And I seriously doubt that this is a smart way to select models.
Murray
murray.efford
 
Posts: 712
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 1 guest