Description Usage Arguments Details
View source: R/adaptive_expectation.R
This function computes expectation (generally for price or yield) as an autoregressive function of the price time series.
y_i = α y_{i-1} + (1-α) x_i
1 | calc_adaptive_expectation(t, alpha, datatbl, colname)
|
t |
The current year, for which we wish to calculate the expected price. |
alpha |
Coefficient of previous year term in the autoregressive series. |
datatbl |
Table of price vs. year. This series is assumed not to have any gaps in it and to be in year order, but neither of these conditions are checked. |
colname |
Name of the column that has the data for which we are
computing the expectation (e.g. |
There is some dispute over what the final term in this series should be. In this implementation the final term is just like all the others; therefore, for α = 0 this formula reduces to y_i = x_i, the equivalent of perfect expectation.
This function is not currently vectorized; a separate call is needed
for each value of t
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.