Learn R Programming

shinystan (version 2.0.0)

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

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

Value

sso, updated. See Examples.

See Also

as.shinystan

Examples

Run this code
#################
### Example 1 ###
#################

# Below, assume X is a shinystan object and two of the
# parameters are alpha and beta.

# Add parameter gamma = inverse-logit(beta) to X
inv_logit <- function(x) 1/(exp(-x) + 1)
X <- generate_quantity(sso = X,
                       fun = inv_logit,
                       param1 = "beta",
                       new_name = "gamma")


# Add parameter delta = (alpha-beta)^2 to X
X <- generate_quantity(sso = X,
                       fun = function(x,y) (x-y)^2,
                       param1 = "alpha",
                       param2 = "beta",
                       new_name = "delta")

launch_shinystan(X)

Run the code above in your browser using DataLab