View source: R/all_model_select.R
bestmodel | R Documentation |
Convenience function for extracting angmcmc object, and the value of the model selection criterion corresponding to the best fitted model in stepwise fits
bestmodel(step_object)
bestcriterion(step_object)
step_object |
stepwise fitted object obtained from fit_incremental_angmix. |
These are convenience functions; the best fitted model and the corresponding value of model selection criterion
can also be directly obtained by
extracting the elements "fit.best"
and "crit.best"
from step_object
respectively.
Note that bestcriterion} returns: (a) a scalar number (class =
numeric) if
critused in original
fit_incremental_angmixcall is
'AIC',
'BIC'or
'DIC', (b) an element of class
bridgefrom package
bridgesamplingif
critis
LOGML, (c) an element of class
c("waic", "loo")if
crit = 'WAIC', and (d) an element of class
c("psis_loo", "loo")if
crit = "LOOIC"'. See documentations of these model
selection criteria for more details.
bestmodel
returns an angmcmc
object, and
bestcriterion
returns the corresponding value of model selection criterion for the best fitted model in step_object
.
# illustration only - more iterations needed for convergence
set.seed(1)
fit.vmsin.step.15 <- fit_incremental_angmix("vmsin", tim8, start_ncomp = 1,
max_ncomp = 3, n.iter = 15,
n.chains = 1,
crit = "WAIC")
fit.vmsin.best.15 <- bestmodel(fit.vmsin.step.15)
fit.vmsin.best.15
crit.best <- bestcriterion(fit.vmsin.step.15)
crit.best
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.