qi_slimmer {coreSim} | R Documentation |
Find maximum, minimum, and median values for each scenario found using
qi_builder
Description
Find maximum, minimum, and median values for each scenario found using
qi_builder
Usage
qi_slimmer(df, scenario_var = "scenario_", qi_var = "qi_")
Arguments
df |
a data frame of simulated quantities of interest created by
|
scenario_var |
character string of the variable name marking the scenarios. |
qi_var |
character string of the name of the variable with the simulated quantity of interest values. |
Details
This funciton slims down a simulation data set to some of its key features (minimun, median, and maximum value for each fitted scenario) so that it takes up less memory and can be easily plotted.
The function is incorporated into qi_builder
and can be run
using slim = TRUE
.
Value
A data frame with the fitted values and the minimum (qi_min
),
median (qi_median
), and maximum (qi_max
) values from the
central interval specified with ci
in qi_builder
.
Examples
library(car)
# Normal linear model
m1 <- lm(prestige ~ education + type, data = Prestige)
# Simulate coefficients
m1_sims <- b_sim(m1)
# Create fitted values
fitted_df <- expand.grid(education = 6:16, typewc = 1)
# Find predicted outcomes (95% central interval, by default)
linear_qi <- qi_builder(b_sims = m1_sims, newdata = fitted_df, slim = FALSE)
# Slim data set
linear_slim <- qi_slimmer(linear_qi)
[Package coreSim version 0.2.4 Index]