Fits a simple univariate state space model, x[t] = alpha + phi x[t-1] + w[t], and y[t] = A x[t] + v[t]. The parameters alpha, phi, sigma[w] and sigma[v] are estimated; parameter phi may be fixed. State predictions and smoothers and corresponding error variances are evaluated at the estimates. The sample size must be at least 20.
ssm(y, A, phi, alpha, sigw, sigv, fixphi = FALSE)
At the MLEs, these are returned invisibly:
time series - state prediction, \(x_t^{t-1}\)
corresponding MSPEs, \(P_t^{t-1}\)
time series - state filter, \(x_t^t\)
corresponding MSEs, \(P_t^t\)
time series - state smoother, \(x_t^n\)
corresponding MSEs, \(P_t^n\)
data
measurement value (fixed constant)
initial value of phi, may be fixed
initial value for alpha
initial value for sigma[w]
initial value for sigma[v]
if TRUE, the phi parameter is fixed
D.S. Stoffer
The script works for a specific univariate state space model. The initial state conditions use a default calculation and cannot be specified. The parameter estimates are printed and the script returns the state predictors and smoothers.
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/blob/master/NEWS.md.
The webpages for the texts are https://www.stat.pitt.edu/stoffer/tsa4/ and https://www.stat.pitt.edu/stoffer/tsda/.