Page 1 of 1

Extracting information from best model

PostPosted: Mon Jul 08, 2013 8:12 am
by pascalinelg
Hi all,

Using R, we have simulated a series of 100 input files in multistrata format. We the used RMark to define a set of models in order to estimate demographic parameters. we would like to extract information (formula, parameter estimate and variance) from the best model for each simulated data without knowing the model number (unlike in the example "myresults[[3]]") .

we tried things like:
bestmodel=caphist.results[caphist.results$model.table$DeltaAICc==0]
bestmodel$model.name
bestmodel$results$real

but it doesn’t work

we ‘ve also tried to extract the formula of S, Psi and p from the first line of the model.table and construct a model with these parameters, but it doesn’t work

does anyone know how we can do it?

Thanks in advance.

Pascaline

Re: Extracting information from best model

PostPosted: Mon Jul 08, 2013 9:18 am
by jlaake
The model numbers are the row numbers in the model.table assuming you used mark.wrapper to run the models. Try the following

Code: Select all
bestmodel=as.numeric(rownames(caphist.results$model.table)[1])
capthist.results[[bestmodel]]$results$real

Re: Extracting information from best model

PostPosted: Tue Jul 09, 2013 2:58 am
by pascalinelg
Hi,

thank you very much, it's work very well!

I use collect.models (because I test only a reduced number of models) and it works as well

to extract the formula I added the line:

caphist.results$model.table[1,4]

to extract the parameter estimates I use the code you posted
bestmodel=as.numeric(rownames(caphist.results$model.table)[1])
caphist.results[[bestmodel]]$results$real

thanks again for your quick answer!
Pascaline