Kalman Filter Hedge Ratio: Pairs Trading के लिए Dynamic Regression
जानें कि state-space regression बदलते hedge ratio को कैसे अपडेट करता है, process noise responsiveness कैसे नियंत्रित करता है, और filtered spread को भी out-of-sample validation क्यों चाहिए
इस गाइड मेंDynamic hedge ratio बदलते संबंध को model करता है
संक्षिप्त सारांश
Kalman filter हर नया observation आने पर regression intercept और hedge coefficient अपडेट कर सकता है। बदलता estimate संबंध के विकास का model है; यह cointegration, mean-reverting spread या लाभदायक signal का प्रमाण नहीं है।
Dynamic hedge ratio बदलते संबंध को model करता है
Fixed hedge ratio formation sample पर एक coefficient fit करता है और उसे स्थिर रखता है। Dynamic hedge model में intercept और slope को ऐसी latent quantities माना जाता है जो समय के साथ बदल सकती हैं। Kalman filter पिछले estimate और नए observation की जानकारी को मिलाकर इन्हें recursively estimate करता है।
दो संभावित assets में एक की log price को \(y_t\) और दूसरे की log price को \(x_t\) मानें। बदलता हुआ long-run regression \(y_t=\alpha_t+\beta_t x_t+\epsilon_t\) लिखा जा सकता है। Coefficient \(\beta_t\) समय \(t\) पर fit हुए संबंध को बताता है; यह अपने-आप share count, dollar-neutral position या स्थिर economic law नहीं बनता।
यह application linear state-space model का सामान्य prediction-and-update recursion इस्तेमाल करता है। Kalman ने recursive filtering framework प्रस्तुत किया और बाद के econometric कार्यों ने समय के साथ बदलते regression coefficients पर इसे लागू किया। Stochastic spread पर आधारित pairs trading इसका एक उपयोग है, लेकिन trading assumptions को filtering algorithm से अलग परखना चाहिए।

Regression coefficients को hidden state में रखें
State vector और observation row इस तरह परिभाषित करें:
\[ \theta_t= \begin{bmatrix}\alpha_t\\\beta_t\end{bmatrix}, \qquad H_t=\begin{bmatrix}1&x_t\end{bmatrix}. \]
Observation equation है \(y_t=H_t\theta_t+\epsilon_t\)। इसका अर्थ है कि observed log price, latent intercept और hedge coefficient के साथ observation noise से जुड़ी है। एक सामान्य शुरुआती specification में दोनों coefficients random walk follow करते हैं:
\[ \theta_t=\theta_{t-1}+\eta_t,\qquad \eta_t\sim N(0,Q),\qquad \epsilon_t\sim N(0,R). \]
यहाँ \(Q\) coefficient changes का covariance और \(R\) observation-noise variance है। \(Q=0\) करने पर इस model में coefficients fixed रहते हैं; धनात्मक \(Q\) उन्हें drift करने देता है। दूसरी state transitions भी संभव हैं, लेकिन हर एक संबंध के व्यवहार के बारे में अलग दावा करती है।
यह सरल specification मानती है कि process और observation disturbances का mean शून्य है, उनमें serial correlation नहीं है और वे परस्पर independent हैं। ये model की assumptions हैं; price observations अपने-आप इन्हें पूरा नहीं करते।
नया price देखने से पहले state और uncertainty का अनुमान लगाएँ
\(t-1\) के अंत में filter के पास estimate \(\hat\theta_{t-1|t-1}\) और covariance \(P_{t-1|t-1}\) है। Random-walk state equation से prediction मिलता है:
\[ \hat\theta_{t|t-1}=\hat\theta_{t-1|t-1}, \qquad P_{t|t-1}=P_{t-1|t-1}+Q. \]
Estimate आगे ले जाया जाता है, जबकि uncertainty अनुमत coefficient-change covariance से बढ़ती है। \(P\) निर्धारित model के तहत latent regression state की uncertainty बताता है। यह pair के trading loss का forecast या portfolio risk का पूरा माप नहीं है।
One-step fitted observation \(H_t\hat\theta_{t|t-1}\) है। Prior state का उपयोग इसलिए मायने रखता है क्योंकि वह नए \(y_t\) को देखे बिना बना था। यदि उसी observation से coefficients अपडेट करके फिर residual निकालें, तो update पहले ही residual को शून्य की ओर खींच चुका है।
\(H_t\) में \(x_t\) शामिल है, इसलिए मौजूदा explanatory price \(S_t\) और gain दोनों को प्रभावित करता है। Slope uncertainty पर्याप्त हो तो अलग-अलग \(x_t\) वाले observations, \(\beta_t\) के बारे में अलग जानकारी दे सकते हैं; intercept-slope covariance भी महत्वपूर्ण है। \(x_t\) को center या rescale करने से intercept और coefficient की units बदलती हैं, इसलिए \(Q\) के संबंधित तत्व और initial \(P\) को भी transform या दोबारा estimate करना चाहिए, जस का तस नहीं रखना चाहिए।
Innovation तय करता है कि filter hedge estimate कैसे अपडेट करेगा
नया observation आने पर उसका one-step prediction error, या innovation, है:
\[ v_t=y_t-H_t\hat\theta_{t|t-1}, \qquad S_t=H_tP_{t|t-1}H_t^{\mathsf T}+R. \]
Innovation variance \(S_t\), अनुमानित state uncertainty और observation noise को जोड़ता है। Kalman gain और state update हैं:
\[ K_t=P_{t|t-1}H_t^{\mathsf T}S_t^{-1}, \qquad \hat\theta_{t|t}=\hat\theta_{t|t-1}+K_tv_t. \]
Gain नए surprise को estimated relationship में बदलाव और noise के बीच बाँटता है। Gain जितना बड़ा होगा, estimate इस observation के अनुसार उतना अधिक बदलेगा; इसका मतलब संबंध अधिक भरोसेमंद होना नहीं है।
मान लें एक काल्पनिक filter \(\hat\alpha=2.0\) और \(\hat\beta=1.20\) predict करता है, जबकि \(x_t=50\), इसलिए \(\hat y=62.0\)। यदि observed \(y_t=62.8\), तो innovation \(0.8\) होगा। Model gain \([0.08,0.006]^{\mathsf T}\) होने पर updated intercept \(2.064\) और slope \(1.2048\) है। ये केवल गणना समझाने वाले काल्पनिक मान हैं; न empirical hedge ratio, न इस बात का प्रमाण कि deviation पलटेगा।
Process noise और measurement noise अलग तरह की flexibility तय करते हैं
Process-noise matrix \(Q\) बताता है कि observations के बीच regression coefficients कितना बदल सकते हैं। बड़ा \(Q\) आमतौर पर gain बढ़ाता है और estimate अधिक responsive बनाता है। इससे वास्तविक बदलाव जल्दी पकड़ा जा सकता है, लेकिन अस्थायी noise का पीछा करने और hedge weights तेजी से बदलने का जोखिम भी है। बहुत छोटा \(Q\) estimate को smooth करता है, पर असली break के बाद वह पीछे रह सकता है।
Observation-noise variance \(R\), संबंध से न समझाए गए \(y_t\) के variation को बताता है। अन्य चीजें समान हों तो बड़ा \(R\) filter को हर नए observation पर कम भरोसा करने देता है। \(Q\) और \(R\) में से कोई भी universal tuning constant नहीं है। इनका scale इस पर निर्भर करता है कि model prices, log prices या normalized series का उपयोग करता है और sampling interval क्या है।
Analyst likelihood से noise parameters estimate कर सकता है या training window के आधार पर पहले से तय कर सकता है; लेकिन अंतिम trading period को देखकर tuning करने से outcome information leak होती है। Starting state \(\hat\theta_{0|0}\) और उसका covariance \(P_{0|0}\) भी मायने रखते हैं: initialization uncertainty अधिक हो तो शुरुआत में तेज adjustment हो सकता है। Initialization, parameter-estimation sample और उचित विकल्पों के प्रति sensitivity रिपोर्ट करें।
Filtering और smoothing अलग information sets इस्तेमाल करते हैं
Filtered estimate \(\hat\theta_{t|t}\), समय \(t\) तक के observations इस्तेमाल करता है। Smoothed estimate समय \(t\) के बाद आए observations भी इस्तेमाल कर सकता है। Smoothing ऐतिहासिक latent states का वर्णन करने में मदद करता है, लेकिन ऐतिहासिक decision time पर trader को वह जानकारी उपलब्ध नहीं थी।
\(Q\), \(R\), pair selection और signal threshold के estimation में भी timing की यही समस्या है। पूरे sample पर एक बार fit करने से, भले coefficient recursion एक दिशा में हो, शुरुआती estimates बाद के observations से लाभान्वित होते हैं। Real-time simulation में hyperparameters केवल formation period पर fit करें, फिर उन्हें freeze करें या घोषित walk-forward schedule पर अपडेट करें। हर position decision execution से पहले उपलब्ध जानकारी पर आधारित हो।
Observation time, fill time नहीं है। यदि \(v_t\) निकालने के लिए \(t\) का closing price चाहिए, तो execution process में संभव न होने पर backtest उसी close पर fill मान नहीं सकता। अगला executable quote या उचित execution model लें और spread, market impact, fees, borrow तथा financing cost शामिल करें।
Hedge coefficient अपने-आप portfolio weight या spread signal नहीं है
Pairs study में pre-update innovation \(v_t\), prior fitted relationship के सापेक्ष surprise है। इसे \(\sqrt{S_t}\) से बाँटने पर model के तहत standardized innovation मिलता है। यह अलग-अलग uncertainty वाले समय में surprises की तुलना में मदद करता है, लेकिन यह नहीं बताता कि किस asset को कितना खरीदना या बेचना है, अथवा बड़ा deviation पलटेगा।
Post-update residual \(y_t-H_t\hat\theta_{t|t}\) अलग quantity है क्योंकि यह मौजूदा observation से coefficients को revise करता है। इस residual को pre-update threshold के साथ मिलाने से signal का अर्थ बदल जाता है। Spread, timing और threshold स्पष्ट परिभाषित करें, और बताएँ कि coefficient prior, filtered या smoothed है।
\(\beta_t\) को log prices से estimate करने पर भी orders बनाने के लिए अलग position rule चाहिए। Log-price weights सीधे share या contract count नहीं बताते। Price, contract multiplier, currency और account constraints dollar exposure तय करते हैं; intercept traded asset नहीं है। Coefficient updates के बीच rebalancing cost और exposure drift भी मायने रखते हैं।
बदलता coefficient model की विफलता छिपा सकता है
धीरे drift करता coefficient क्रमिक बदलाव दिखाने का उपयोगी तरीका हो सकता है, लेकिन यह टूटे हुए संबंध को absorb भी कर सकता है। Flexible states वाला model स्थिर long-run equilibrium न होने पर भी fitted residual छोटा दिखा सकता है। Filter cointegration test नहीं करता और residual के stationary होने की गारंटी नहीं देता।
Pair selection भी महत्वपूर्ण है। अनेक assets में screening करके उसी जोड़ी को रखना जिसका in-sample residual सबसे smooth है, स्थिरता के दावे के लिए उसी data पर चयन करना है। Corporate actions, stale prices, asynchronous closes, short-sale constraints, liquidity changes और regime shifts estimated states बदल सकते हैं या कागज़ी hedge को execute करना कठिन बना सकते हैं।
Fitted line के साथ residual behavior, state uncertainty, turnover और coefficient paths देखें। Chronological holdout periods लें और fixed-ratio benchmark से तुलना करें। अधिक adaptive estimate को realistic costs के बाद अतिरिक्त turnover और estimation risk की भरपाई करनी चाहिए; केवल smooth दिखना performance result नहीं है।
दूसरे analyst को परिणाम दोहराने लायक विवरण दें
बताएँ कि कौन-सी price या return series model की गई, उसका transformation, observation frequency, sample dates और regression के दोनों पक्षों पर कौन-सा asset है। Observation और state equations, transition matrix, \(Q\), \(R\), initialization, estimation method, और रिपोर्ट किया गया state filtered है या smoothed—सब दें।
Trading result के लिए signal में इस्तेमाल innovation या spread, normalization, decision timestamp, order delay, position sizing, rebalance rule और हर execution cost परिभाषित करें। Pair screening, training/test windows, noise parameters दोबारा कैसे tune हुए, तथा break या missing observation के बाद strategy का व्यवहार बताएं। Fixed और dynamic coefficients को एक जैसे chronological splits पर तुलना करें।
Kalman का linear filtering paper recursive framework विकसित करता है। Hatanaka समय के साथ बदलते कुछ coefficients वाले regression का अध्ययन करते हैं। Elliott, van der Hoek और Malcolm pairs trading का stochastic model प्रस्तुत करते हैं। संबंधित विषयों के लिए Kalman filter prediction और update, pairs trading में cointegration बनाम correlation, Johansen rank test, और variance-ratio test की गाइड देखें।
आम सवाल
Q1क्या Kalman filter साबित करता है कि pair cointegrated है?
नहीं। यह state-transition और observation assumptions के तहत latent states estimate करता है। Flexible hedge coefficient बदलते data के साथ चल सकता है, लेकिन stable stationary combination स्थापित नहीं करता।
Q2क्या dynamic hedge ratio हमेशा fixed ratio से बेहतर होता है?
नहीं। यह वास्तविक बदलाव का जवाब दे सकता है, पर noise का पीछा, turnover में वृद्धि और parameter risk भी ला सकता है। दोनों की तुलना समान chronological out-of-sample periods और realistic costs पर करें।
Q3क्या updated residual को innovation जैसा ही signal मान सकता हूँ?
नहीं। Innovation वर्तमान observation से coefficients update होने से पहले की prior state इस्तेमाल करता है। Post-update residual उसी observation से coefficients revise करता है, इसलिए दोनों अलग quantities हैं। ---
स्रोत और आगे पढ़ें
समस्या की रिपोर्ट करें
हम इस लेख का लिंक जोड़कर ईमेल तैयार करेंगे। भेजने के बाद ही Mark को आपकी रिपोर्ट मिलेगी
त्वरित जाँच
गाइड पढ़ने के बाद 3 सवालों से खुद को जाँचें
सवाल 01
State-space regression में process-noise covariance Q क्या नियंत्रित करता है?
व्याख्या देखने के लिए एक उत्तर चुनें
विकल्प शब्दावली
A recursion predicting and updating state means and error covariances in a linear Gaussian state-space model.
विस्तृत गाइड पढ़ेंCointegrationThe existence of a stationary linear combination among nonstationary series, implying a shared long-run equilibrium restriction under a specified model.
विस्तृत गाइड पढ़ें