Description Arguments Value See Also Examples
Function returned from mssm
which can be used to perform
parameter estimation with a Laplace approximation.
cfix |
starting values for coefficient for the fixed effects. |
disp |
starting value for additional parameters for the family (e.g., a dispersion parameter). |
F. |
starting values for matrix in the transition density of the state vector. |
Q |
starting values for covariance matrix in the transition density of the state vector. |
Q0 |
un-used. |
mu0 |
un-used. |
trace |
integer controlling whether information should be printed during parameter estimation. Zero yields no information. |
An object of class mssmLaplace
with the following elements
F. |
estimate of |
Q |
estimate of |
cfix |
estimate of |
logLik |
approximate log-likelihood at estimates. |
n_it |
number of Laplace approximations. |
code |
returned code from |
disp |
estimated dispersion parameter. |
Remaining elements are the same as returned by mssm
.
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 fit glm to get starting values
data("Gasoline", package = "Ecdat")
glm_fit <- glm(lgaspcar ~ factor(country) + lincomep + lrpmg + lcarpcap,
Gamma("log"), Gasoline)
# get object to perform estimation
library(mssm)
ll_func <- mssm(
fixed = formula(glm_fit), random = ~ 1, family = Gamma("log"),
data = Gasoline, ti = year, control = mssm_control(
N_part = 1000L, n_threads = 1L))
# fit model with time-varying intercept with Laplace approximation
disp <- summary(glm_fit)$dispersion
laplace <- ll_func$Laplace(
cfix = coef(glm_fit), disp = disp, F. = diag(.5, 1), Q = diag(1))
print(laplace)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.