extract_timeseries_stock: Extract the values over time of a stock from a Stan fit

Description Usage Arguments Value Examples

View source: R/stan_utils.R

Description

Extract the values over time of a stock from a Stan fit

Usage

1
extract_timeseries_stock(stock_name, posterior_df, all_stocks, ODE_output)

Arguments

stock_name

A string that indicates the stock's name for which the function will construct the timeseries.

posterior_df

A Stan fit object converted into a data frame

all_stocks

A vector of strings that contains the names of all the stocks in the model. This vector must have the same order as the differential equations in the Stan code.

ODE_output

A string that indicates the name of the variable where model's output in stored in Stan.

Value

A data frame

Examples

1
2
3
4
posterior_df <- data.frame(`yhat[1,2]` = rep(0, 2), `yhat[2,2]` = rep(1, 2),
                            check.names = FALSE)
stocks       <- c("S1", "S2")
extract_timeseries_stock("S2", posterior_df, stocks, "yhat")

readsdr documentation built on Jan. 13, 2021, 11:08 a.m.