ssm | R Documentation |
Fits a simple univariate state space model to data. The parameters are estimated (the state regression parameter may be fixed). State predictions, filters, 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)
y |
data |
A |
measurement value (fixed constant) |
phi |
initial value of phi, may be fixed |
alpha |
initial value for alpha |
sigw |
initial value for sigma[w] |
sigv |
initial value for sigma[v] |
fixphi |
if TRUE, the phi parameter is fixed |
The script works for a specific univariate state space model,
x_t = \alpha + \phi x_{t-1} + w_t \quad {\rm and} \quad y_t = A x_t + v_t.
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. The regression parameter \phi
may be fixed.
At the MLEs, these are returned invisibly:
Xp |
time series - state prediction, |
Pp |
corresponding MSPEs, |
Xf |
time series - state filter, |
Pf |
corresponding MSEs, |
Xs |
time series - state smoother, |
Ps |
corresponding MSEs, |
D.S. Stoffer
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 and some help on using R for time series analysis can be found at https://nickpoison.github.io/.
## Not run:
u = ssm(gtemp_land, A=1, alpha=.01, phi=1, sigw=.05, sigv=.15)
tsplot(gtemp_land, type='o', col=4)
lines(u$Xs, col=6, lwd=2)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.