Can anyone help? Has anyone written a Kalman filter in J? I'm not a specialist in either statistics or control theory, so I'm only guessing a Kalman filter is what I need. Though I do have a passing acquaintance with the terms: stochastic control and linear quadratic Gaussian (LQG) control. I am aware that a "Kalman filter" (like ANOVA) is more a topic than a black-box.
So let me explain what I want it for. I have a time series X which I am assuming can be modelled like this: X=: K + G + (X1,X2) where K is constant G is Gaussian noise X1 is a random variable with mean: M1 and variance: V1 X2 is a random variable with mean: M2 and variance: V2 Typically X is a sequence of sensor readings, but may also be measurements from a series of user trials conducted on a working prototype, which suffers a design-change at a given point T. Simplifying assumptions (which unfortunately I may need to relax in due course): (a) X is not multivariate (b) X1 and X2 are Gaussian (c) V1=V2 (only the mean value changes, not the variance). The problem: 1. Estimate T=: 1+#X1 -- the point at which X1 gives way to X2. 2. Given T, estimate (M2-M1) -- the "underlying improvement", if any, of the change to the prototype. 3. (subcase of 2.) Given T, test the null hypothesis: M1=M2, viz that there has been no underlying improvement. 4. Estimate U=: #X2 -- the minimum number of samples needed after T in order to achieve 1-3 above with 95% confidence. In other words, detect the signal-in-noise: M1-->M2, and do so in real-time. Because of 4, the need to estimate T and (M2-M1) on an ongoing basis, I can't do a randomised block design. I gather that a Kalman filter, or some sort of adaptive filter, will handle this problem. But maybe something simpler will turn out good enough? Supposing I can get hold of a "black box" Kalman filter, I propose to test it out on generated data and compare its performance to some simple-minded approach, like estimating M1 / M2 from a simple moving average of the last U samples, or applying the F-test to 2 sets of U samples taken either side of T. But since the technique aims to be published, or at least critically scrutinised (and maybe incorporated in a software product), I'd rather depend on a state-of-art packaged solution than reinvent the wheel: a large and very well-turned wheel it appears to me. Ian Clark ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm