Description Usage Arguments Details Value See Also Examples
uses an empirical approach to calculate prediction intervalls for each predicted vs. observed value pair. The calculated raw prediction intervalls represent a quite flexible fit which can be used to build a less felxible model of the intervalls.
1 2 3 | f_prediction_intervall_raw(df, pred_col, obs_col, intervall = 0.95,
n_neighbours = 500, rm_outliers = T, bootstrap = F, steps = T,
verbose = T)
|
df |
a dataframe containing predictions and obsvervation pairs |
pred_col |
character vector denoting column with predictions |
obs_col |
character vector denoting column with observed values |
intervall |
double, denoting intervall decision boundary Default: 0.95 |
n_neighbours |
integer, denoting the number of neighbouring values to be considered for the intervall calculation, Default: 500 |
rm_outliers |
logical, remove outlier based on boxstats definition, Default: T |
bootstrap |
logical, if TRUE intervall decision boundary will be calculated by bootstrapping the population of neighbouring values, if FALSE a normal distribution will be assumed and decision boundary will be calculated based on the mean, Default: F |
steps |
logical, if TRUE predictions will be binned instead of considering the neighbouhood of each point, Default: T |
verbose |
logical |
DETAILS
OUTPUT_DESCRIPTION
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## Not run:
m = lm(price ~ carat + depth, ggplot2::diamonds)
df = tibble( obs = ggplot2::diamonds$price
, pred = predict(m, newdata = ggplot2::diamonds) ) %>%
f_prediction_intervall_raw( 'pred','obs', intervall = 0.975) %>%
f_prediction_intervall_raw( 'pred','obs', intervall = 0.025)
df
ggplot2::ggplot(df) +
geom_point( aes( x = pred, y = obs), data = dplyr::sample_n(df, 500)
, alpha = 0.5 ) +
geom_line( aes(x = pred, y = pred_PI2.5_raw ), size = 1, color = 'darkgreen' ) +
geom_line( aes(x = pred, y = pred_PI97.5_raw ), size = 1, color = 'darkgreen' ) +
geom_line( aes(x = pred, y = pred_mean_raw ), size = 1, color = 'tomato' )
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.