Ok, this makes sense, thanks. One thing that I can't figure out is how to control the responsiveness of the Kalman filter. A lot of indicators in JBT calculate the difference between the "fast" and "slow" moving averages, such as EMA(10) and EMA(100). What would be the equivalent way to make Kalman filter faster and slower?
On Sat, Oct 23, 2010 at 2:17 AM, Astor <[email protected]> wrote: > Thank Eugene. That will be a good tool to have. > > From your graph, as expected Kalman responds faster than the EMA to sharp > changes in price. That is to be expected because the averaging constant > adapts to increased volatility. It also appears to overshoot in a few > places. That could be because you have set up the transition matrix to > forecast the price by local linear regression of the price trend, which > causes the filter to overshoot at discontinities in price trend (i.e. where > first derivative of the time-series is not defined). > > The transition matrix is where the forecasting resides. Also, the filter > can simultaneously forecast multiple time-series, which may affect each > other. This relationship also is encoded in transition matrix. > > 1. The simplest kalman filter is scalar filter without linear > regression forecasts. This filter provides adaptive average of a single time > series and is most similar to EMA. To set it up in the code, the > constructor parameters should be set at (1,1): > > *kalman = new JKalman(1, 1);* > > The transition matrix should be set up as: > > *transition_matrix = Matrix.identity(dp, dp); * > > This should be equivalent to setting the transition matrix tr = 1 ( a > scalar, not a matrix - hence scalar kalman filter). > > > 2. If you think that you want a linear regression forecasts after all, > then the constructor should be: *kalman = new JKalman(1, 1);* > The transition matrix should be *tr = {{1,1},{0,1}}*. That non-zero > off-diagonal element in the matrix increments each next step by dx, and > creates the localized linear regression behavior. > > 3. If you want to forecast two time series (price and volume, lets > say) with linear regression for each, for example x and y, then the > constructor is: *kalman = new JKalman(4, 2); *and *tr = { {1, 0, 1, 0}, > {0, 1, 0, 1}, {0, 0, 1, 0}, {0, 0, 0, 1} };* By changing off-diagonal > elements from 0 to 1 in matrix tr, you could model linear interaction > between those time series. > > Another useful information that can be extracted from this software is: * > error_cov_post*. This is *ex post* forecasted covariance of the error > matrix. Diagonal elements could be usefull for entry / exit points. > Off-diagonal elements may give some insights into cross- indicator noise > sensitivity. > > > > ------------------------------ > *From:* Eugene Kononov <[email protected]> > *To:* [email protected] > *Sent:* Fri, October 22, 2010 9:16:30 PM > > *Subject:* Re: [JBookTrader] Re: Status of Kalman filter? > > And here is a comparison. > > -- > You received this message because you are subscribed to the Google Groups > "JBookTrader" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<jbooktrader%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/jbooktrader?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "JBookTrader" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<jbooktrader%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/jbooktrader?hl=en. > -- You received this message because you are subscribed to the Google Groups "JBookTrader" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jbooktrader?hl=en.
