1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

R: dlmMLE usage

Posted at

This is the tool to help us with the M step.
This is connected to optim, so we can use that as well.
We are still using the model

x_0 ~ N(m0, C0) 
x_t = GG x_{t-1} + w_t v_t ~ N(0, W)
Y_t = FF x_t + v_t w_t ~ N(0, V)

function dlmMLE

Input: 

Data:
	The time series data.

Parameters: 
	The parameters subject to the Likelihood optimization

build:
	function that returns a dlm object. That is, 
	build=function(x) will make the objective 		function the likelihood function of the dlm governed by parameter x. 

Example:

buildTest <- function(x){ 
	m <- dlmModPoly(1, dV = exp(x[1]))
	m$JW  <- matrix(1)
	m$X <- matrix(exp(x[2]), nc = 1, nr = length(Nile))
	j <- which(time(Nile) == 1899)
m$X[j,1] <- m$X[j,1] * (1+ exp(x[3]))
return(m) 	 
}

buildTest will give me dlm dependent on three parameters, in which W is given by
exp(x[2])*(1+ exp(x[3])).

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?