Description Usage Arguments Details Value Author(s) References See Also Examples
Estimates hidden states of a partially autoregressive model
1 | statehistory.par(A, data = A$data)
|
A |
A |
data |
A sequence of observed states |
Based on the parameters of the model fitted by the previous call to
fit.par
, produces a data.frame
containing the inferred
hidden states of the process.
A data.frame
with one row for each observation in data
.
The columns in the data.frame
are as follows:
X |
Value of the observed state ( |
M |
Estimated value of the mean-reverting component at this time |
R |
Estimated value of the random walk component at this time |
eps_M |
Estimated innovation to the mean-reverting component |
eps_R |
Estimated innovation to the random walk component |
Matthew Clegg matthewcleggphd@gmail.com
Clegg, Matthew. Modeling Time Series with Both Permanent and Transient Components using the Partially Autoregressive Model. Available at SSRN: http://ssrn.com/abstract=2556957
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # A simple example to compare the fitted values of the mean-reverting
# component with the actual data
set.seed(1)
xactual <- rpar(1000, 0.9, 2, 1, include.state=TRUE)
xfit <- fit.par(xactual$X)
xstates <- statehistory.par(xfit)
summary(lm(xstates$M ~ xactual$M))
## Not run:
require(ggplot)
xdf <- rbind(data.frame(data="actual", x=1:nrow(xactual), value=xactual$M),
data.frame(data="fitted", x=1:nrow(xstates), value=xstates$M))
ggplot(xdf, aes(x=x, y=value, colour=data)) + geom_line()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.