Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

generate_quantity

Add new quantity to shinystan object


Description

Add to shinystan object a new parameter as a function of one or two existing parameters.

Usage

generate_quantity(sso, param1, param2, fun, new_name)

Arguments

sso

A shinystan object.

param1

Name of first parameter as character string.

param2

Optional. Name of second parameter as character string.

fun

Function to call, i.e. function(param1) or function(param1,param2). See Examples, below.

new_name

Name for the new parameter as character string.

Value

sso, updated. See Examples.

See Also

drop_parameters to remove parameters from a shinystan object.

Examples

# Using example shinystan object 'eight_schools'
sso <- eight_schools
sso <- generate_quantity(sso, fun = function(x) x^2, 
                         param1 = "tau", new_name = "tau_sq")
sso <- generate_quantity(sso, fun = "-", 
                         param1 = "theta[1]", param2 = "theta[2]", 
                         new_name = "theta1minus2")

shinystan

Interactive Visual and Numerical Diagnostics and Posterior Analysis for Bayesian Models

v2.5.0
GPL (>= 3)
Authors
Jonah Gabry [aut, cre], Stan Development Team [ctb], Michael Andreae [ctb], Michael Betancourt [ctb], Bob Carpenter [ctb], Yuanjun Gao [ctb], Andrew Gelman [ctb], Ben Goodrich [ctb], Daniel Lee [ctb], Dongying Song [ctb], Rob Trangucci [ctb]
Initial release
2018-04-29

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.