Re: [R] Question on KalmanSmooth

From: Spencer Graves <spencer.graves_at_pdf.com>
Date: Fri 02 Dec 2005 - 03:43:23 EST

          You asked about the behavior of KalmanSmooth(...)$var with missing values. I also got very counterintuitive results from your excellent, reproducible example using R 2.2.0 under Windows XP:

          If I had more time to work on this, I would dig into the code and compare the computations with Durbin and Koopman (2001) referenced in "?KalmanSmooth". The KalmanSmooth function basically consists of '.Call("KalmanSmooth",...)'. If I had more time for this, I could study that code.

          Earlier this year, I started reading Durbin and Koopman (2001). I was able to reproduce their Figure 2.1 but failed to reproduce their Figure 2.2 illustrating "state smoothing recursion". That latter figure includes a plot of the "smoothed state variance", the title of which sounds similar to "KalmanSmooth(...)$var". However, the former roughly doubles near both ends of the series, while the latter is totally constant independent of the data (except in the presence of missing values), at least from what I've seen.

          Perhaps someone else will be able to enlighten both of us.

	  Thanks for raising this question.
	  Spencer Graves

Kjetil Brinchmann Halvorsen wrote:

> I am trying to use KalmanSmooth to smooth a time series
> fitted by arima (and with missing values), but the $smooth component
> of the output baffles me. Look at the following example:
>
> testts <- arima.sim(list(ar=0.9),n=100)
> testts[6:14] <- NA
> testmod <- arima(testts, c(1,0,0))
> testsmooth <- KalmanSmooth(testts, testmod$model)
> par(mfrow=c(2,1))
> plot(testsmooth$smooth, type="l")
> plot(testsmooth$var, type="l")
>
> Look at the lower panel plot, how the uncertainty of the
> smoothed values first is lowered, then being the highest
> at the end ( of the smoothed part, indexes 6:14).
> Anybody can explain this,or is this an error?
>
>
> Kjetil Halvorsen
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

spencer.graves@pdf.com
www.pdf.com <http://www.pdf.com>
Tel:  408-938-4420
Fax: 408-280-7915

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Fri Dec 02 04:33:21 2005

This archive was generated by hypermail 2.1.8 : Fri 02 Dec 2005 - 09:38:23 EST