Description Arguments Value References See Also Examples
Function returned from mssm
which can be used to perform
particle filtering given values for the parameters in the model.
cfix |
values for for coefficient for the fixed effects. |
disp |
additional parameters for the family (e.g., a dispersion parameter). |
F. |
matrix in the transition density of the state vector. |
Q |
covariance matrix in the transition density of the state vector. |
Q0 |
optional covariance matrix at the first time point. Default is the covariance matrix in the time invariant distribution. |
mu0 |
optional mean at the first time point. Default is the zero vector. |
trace |
integer controlling whether information should be printed during particle filtering. Zero yields no information. |
seed |
integer to pass to |
what, N_part |
same as in |
An object of class mssm
with the following elements
pf_output |
A list with an element for each time period. Each element
is a list with
|
Remaining elements are the same as returned by mssm
.
If gradient approximation is requested then the first elements of
stats
are w.r.t. the fixed coefficients, the next elements are
w.r.t. the matrix in the map from the previous state vector to the mean
of the next, and the last element is w.r.t. the covariance matrix.
Only the lower triangular matrix is kept for the covariance
matrix. See the examples in the README at
https://github.com/boennecd/mssm. There will be an additional
element for the dispersion parameter if the family has a dispersion
parameter.
If the Hessian is requested then the \tilde β_n^{(i)}s in Poyiadjis et al. (2011) are returned after the gradient elements. These can be used to approximate the observed information matrix. That is, using that the approximation of the observed information matrix is
\tilde S_n\tilde S_n^\top - ∑_{i = 1}^n \tilde W_n^{(i)}(\tildeα_n^{(i)}\tildeα_n^{(i)\top} + \tilde β_n^{(i)}), \qquad \tilde S_n = ∑_{i=1}^n \tilde W_n^{(i)}\tildeα_n^{(i)}
as in Poyiadjis et al. (2011). See the README for an example.
Poyiadjis, G., Doucet, A. and Singh, S. S. (2011) Particle Approximations of the Score and Observed Information Matrix in State Space Models with Application to Parameter Estimation. Biometrika, 98(1), 65–80.
mssm
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | if(require(Ecdat)){
# load data and get object to perform particle filtering
data("Gasoline", package = "Ecdat")
library(mssm)
ll_func <- mssm(
fixed = lgaspcar ~ factor(country) + lincomep + lrpmg + lcarpcap,
random = ~ 1, family = Gamma("log"), data = Gasoline, ti = year,
control = mssm_control(N_part = 1000L, n_threads = 1L))
# run particle filter
cfix <- c(0.612, -0.015, 0.214, 0.048, -0.013, -0.016, -0.022, 0.047,
-0.046, 0.007, -0.001, 0.008, -0.117, 0.075, 0.048, -0.054, 0.017,
0.228, 0.077, -0.056, -0.139)
pf <- ll_func$pf_filter(
cfix = cfix, Q = as.matrix(2.163e-05), F. = as.matrix(0.9792),
disp = 0.000291)
print(pf)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.