qi_slimmer: Find maximum, minimum, and median values for each scenario...

Description Usage Arguments Details Value Examples

View source: R/utils.R

Description

Find maximum, minimum, and median values for each scenario found using qi_builder

Usage

1
qi_slimmer(df, scenario_var = "scenario_", qi_var = "qi_")

Arguments

df

a data frame of simulated quantities of interest created by qi_builder.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
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)

coreSim documentation built on May 29, 2017, 6:10 p.m.

Related to qi_slimmer in coreSim...