Skip to content

Commit 29af22d

Browse files
committed
Step 3 matches
1 parent 70494cd commit 29af22d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pyacm/acm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,10 @@ def __init__(
160160

161161
# 2nd Step - Excess Returns
162162
self.beta, self.omega, self.beta_star = self._excess_return_regression()
163-
# TODO EVERYTHING RIGHT UP TO HERE
164163

165164
# 3rd Step - Convexity-adjusted price of risk
166165
self.lambda0, self.lambda1, self.mu_star, self.phi_star = self._retrieve_lambda()
166+
# TODO EVERYTHING RIGHT UP TO HERE
167167

168168
if self.curve.index.freqstr == 'M':
169169
X = self.pc_factors_m
@@ -318,14 +318,14 @@ def _excess_return_regression(self):
318318

319319
def _retrieve_lambda(self):
320320
rx = self.rx_m[self.selected_maturities]
321-
factors = np.hstack([np.ones((self.t, 1)), self.pc_factors_m.iloc[:-1].values])
321+
factors = np.hstack([np.ones((self.t_m, 1)), self.pc_factors_m.iloc[:-1].values])
322322

323323
# Orthogonalize factors with respect to v
324324
v_proj = self.v.T @ np.linalg.pinv(self.v @ self.v.T) @ self.v
325325
factors = factors - v_proj @ factors
326326

327327
adjustment = self.beta_star @ self.s0 + np.diag(self.omega).reshape(-1, 1)
328-
rx_adjusted = rx.values + (1 / 2) * np.tile(adjustment, (1, self.t)).T
328+
rx_adjusted = rx.values + (1 / 2) * np.tile(adjustment, (1, self.t_m)).T
329329
Y = (inv(factors.T @ factors) @ factors.T @ rx_adjusted).T
330330

331331
# Compute Lambda

0 commit comments

Comments
 (0)