View source: R/model_judgement.r
model_judgement | R Documentation |
Applies log-likelihood based model comparison to any number of stanfit objects and extracts LOO-CV, WAIC and Raw LPPD measures and plots the models on a absolute scale ranging from 0 (best models) to 1 (worst models). WAIC and LOO-CV code has been adapted directly from the "LOO" package. Because most methods to prevent log-exp calculation-underflow failed, this function imputes underflow values with the mean of sampled values. When this happens, the function will report the amount of imputed values to inform the user. More than 5 Mind how Stan saves log-likelihood values! Consult the Stan manual to check how they are saved correctly! Because all models need to be loaded into memory, be wary if loading to big stanfits. Lighten the Stanfit objects by discarding unnecesary iterations is advised.
model_judgement(..., lik_name = "log_lik", impute_inf = TRUE)
lik_name |
Name under which the log likelihoods have been saved in the models. Needs to be identical across all Stanfit objects. |
impute_inf |
A boolean which regulates if underflow values should be automatically imputed or not. If
|
stanfits |
At least 2 stanfit objects. |
Prints a table and generates a plot with the model ranked according to LOO-CV, WAIC and Raw LPPD.
load(fit1.Rdata)
load(fit2.Rdata)
model_judgement(fit1, fit2, impute_inf = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.