Add to shinystan object a new parameter as a function of one or two existing parameters.
generate_quantity(sso, param1, param2, fun, new_name)
Name of first parameter as character string.
Optional. Name of second parameter as character string.
Function to call, i.e. function(param1)
or
function(param1,param2)
. See Examples, below.
Name for the new parameter as character string.
sso, updated. See Examples.
drop_parameters
to remove parameters from a
shinystan
object.
# Using example shinystan object 'eight_schools'
sso <- eight_schools
sso <- generate_quantity(sso, fun = function(x) x^2,
param1 = "tau", new_name = "tau_sq")
#>
#> This might take a moment for large shinystan objects...
sso <- generate_quantity(sso, fun = "-",
param1 = "theta[1]", param2 = "theta[2]",
new_name = "theta1minus2")
#>
#> This might take a moment for large shinystan objects...