add_metrics1_d()andadd_metrics1_c()extracts the lpd and RPS from the Stanfit objectadd_metrics2_d()andadd_metrics2_c()calculates the lpd and (C)RPS from the empirical pmfThe metrics in
add_metrics2_c()and the CRPS ofadd_metrics1_c()are calculated using thescoringRulespackage.
Usage
add_metrics1_d(df, fit)
add_metrics1_c(df, fit)
add_metrics2_d(df, support, add_samples = support)
add_metrics2_c(df, add_samples = NULL, bw = NULL)Arguments
- df
Dataframe to add the metrics to
For
add_metrics1_c(), it must contain a column "Score".For
add_metrics2_c()andadd_metrics2_d(), it must contain the columns "Samples" and "Score".
- fit
Stanfit object with parameters "lpd", and for
add_metrics1_d()"cum_err".- support
Support of the distribution
- add_samples
Numeric vector used to initialise the distribution when computing the lpd and (C)RPS. For example, this can be used to add a uniform distribution to the vector of samples, to avoid problems at the tail of the distribution. If
NULL, the empirical pmf is not changed. Default to the uniform distribution (i.e.support) foradd_metrics2_d()andNULLforadd_metrics2_c(). The column "Samples" is not modified whenadd_samplesis not NULL.- bw
Bandwidth, for calculating lpd, see
scoringRules::logs_sample(). Useful to set the "resolution" of the distribution.