Description Usage Arguments Details Value Warning Author(s) References See Also Examples
The function returns the MLE of unknown parameters in the specification of a state space model.
1 |
y |
a vector, matrix, or time series of data. |
parm |
vector of initial values - for the optimization routine - of the unknown parameters. |
build |
a function that takes a vector of the same length as
|
method |
passed to |
... |
additional arguments passed to |
debug |
if |
The evaluation of the loglikelihood is done by dlmLL
.
For the optimization, optim
is called. It is possible for the
model to depend on additional parameters, other than those in
parm
, passed to build
via the ...
argument.
The function dlmMLE
returns the value returned by optim
.
The build
argument must return a dlm with nonsingular
observation variance V
.
Giovanni Petris GPetris@uark.edu
Giovanni Petris (2010), An R Package for Dynamic Linear
Models. Journal of Statistical Software, 36(12), 1-16.
http://www.jstatsoft.org/v36/i12/.
Petris, Petrone, and Campagnoli, Dynamic Linear Models with
R, Springer (2009).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | data(NelPlo)
### multivariate local level -- seemingly unrelated time series
buildSu <- function(x) {
Vsd <- exp(x[1:2])
Vcorr <- tanh(x[3])
V <- Vsd %o% Vsd
V[1,2] <- V[2,1] <- V[1,2] * Vcorr
Wsd <- exp(x[4:5])
Wcorr <- tanh(x[6])
W <- Wsd %o% Wsd
W[1,2] <- W[2,1] <- W[1,2] * Wcorr
return(list(
m0 = rep(0,2),
C0 = 1e7 * diag(2),
FF = diag(2),
GG = diag(2),
V = V,
W = W))
}
suMLE <- dlmMLE(NelPlo, rep(0,6), buildSu); suMLE
buildSu(suMLE$par)[c("V","W")]
StructTS(NelPlo[,1], type="level") ## compare with W[1,1] and V[1,1]
StructTS(NelPlo[,2], type="level") ## compare with W[2,2] and V[2,2]
## multivariate local level model with homogeneity restriction
buildHo <- function(x) {
Vsd <- exp(x[1:2])
Vcorr <- tanh(x[3])
V <- Vsd %o% Vsd
V[1,2] <- V[2,1] <- V[1,2] * Vcorr
return(list(
m0 = rep(0,2),
C0 = 1e7 * diag(2),
FF = diag(2),
GG = diag(2),
V = V,
W = x[4]^2 * V))
}
hoMLE <- dlmMLE(NelPlo, rep(0,4), buildHo); hoMLE
buildHo(hoMLE$par)[c("V","W")]
|
$par
[1] 0.4357596 1.1001704 0.1382299 -3.7924821 -1.7111593 4.8004848
$value
[1] 126.4615
$counts
function gradient
84 84
$convergence
[1] 0
$message
[1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH"
$V
[,1] [,2]
[1,] 2.390540 0.638108
[2,] 0.638108 9.028090
$W
[,1] [,2]
[1,] 0.000508033 0.004071366
[2,] 0.004071366 0.032636673
Call:
StructTS(x = NelPlo[, 1], type = "level")
Variances:
level epsilon
0.000 2.394
Call:
StructTS(x = NelPlo[, 2], type = "level")
Variances:
level epsilon
0.03242 9.03080
$par
[1] 0.4365227 1.1128467 0.1426474 0.0000000
$value
[1] 126.5268
$counts
function gradient
10 10
$convergence
[1] 0
$message
[1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH"
$V
[,1] [,2]
[1,] 2.3941909 0.6671363
[2,] 0.6671363 9.2599009
$W
[,1] [,2]
[1,] 0 0
[2,] 0 0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.