ssEst: Steady State Estimate

ssEstR Documentation

Steady State Estimate

Description

Allows for the estimation of process steady state of a single stream for a process using flow rate data.

Usage

ssEst(y, BTE = c(100, 1000, 1), stationary = FALSE)

Arguments

y

Vector of mass flow rate observations. Must be specified sequentially with y[1] as the initial observation.

BTE

Numeric vector giving c(Burn-in, Total-iterations, and Every) for MCMC approximation of target distributions. The function BMB produces a total number of samples of (T - B)/E. E specifies that only one of every E draws are saved. E > 1 reduces autocorrelation between obtained samples at the expense of computation time.

stationary

Logical indicating if stationarity will be imposed when generating posterior draws. See Details.

Details

The model of the following form is fit to the data:

y_t = μ + α y_{t-1} + ε

Where ε \sim \mathcal{N}(0,σ^2) and t indexes the time step.

A time series is stationary, and predictable, when |α|< 1. Stationarity can be enforced, using the argument setting stationary = TRUE. This setting utilizes the priors p(α) \sim \mathcal{N}(0, 1000) truncated at (-1,1), and p(μ) \sim \mathcal{N}(0, var(y)*100) for inference, producing a posterior distribution for α constrained to be within (-1,1).

When fitting a model where stationarity is not enforced, the Jeffreys prior of p(μ,α)\propto 1 is used.

The Jeffreys prior of p(σ^2)\propto 1/σ^2 is used for all inference of σ^2

A stationary time series will have an expected value of:

\frac{μ}{1-α}

Samples of this expectation are included in the output if stationary = TRUE or if none of the samples of α lie outside of (-1,1).

The output list is a BMB object, passing the output to plot.BayesMassBal allows for observation of the results.

Value

Returns a list of outputs

samples

List of vectors containing posterior draws of model parameters

stationary

Logical indicating the setting of the stationary argument provided to the ssEst function

y

Vector of observations initially passed to the ssEst function.

type

Character string giving details of the model fit. Primarily included for use with plot.BayesMassBal

Examples


## Generating Data
y <- rep(NA, times = 21)

y[1] <- 0
mu <- 3
alpha <- 0.3
sig <- 2
for(i in 2:21){
 y[i] <- mu + alpha*y[i-1] + rnorm(1)*sig
}

## Generating draws of model parameters

fit <- ssEst(y, BTE = c(100,500,1))


BayesMassBal documentation built on June 18, 2022, 1:08 a.m.