Skip to content

Commit 5524f3a

Browse files
committed
fix the table latex printing
1 parent 87c08e3 commit 5524f3a

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lectures/hansen_singleton_1983.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ def display_table(df, title=None, fmt=None):
110110
idx_header = r"\text{" + df.index.name + "}" if df.index.name else ""
111111
columns = " & ".join(
112112
[idx_header] + [r"\text{" + c + "}" if "\\" not in c
113+
and "^" not in c and "_" not in c
113114
else c for c in formatted.columns])
114115
rows = r" \\".join(
115116
[" & ".join([str(idx)] + [str(v) for v in row])
@@ -1620,17 +1621,17 @@ pred_pretty = pred_df[
16201621
"var_pred_x": r"\mathrm{Var}(\hat E[X_t\mid\psi_{t-1}])",
16211622
"var_pred_r": r"\mathrm{Var}(\hat E[R_t\mid\psi_{t-1}])",
16221623
"alpha2_var_pred_x": r"\hat{\alpha}^2\,\mathrm{Var}(\hat E[X_t\mid\psi_{t-1}])",
1623-
"r2_x_unrestricted": r"$R_X^2$",
1624-
"r2_r_unrestricted": r"$R_R^2$",
1624+
"r2_x_unrestricted": r"R_X^2",
1625+
"r2_r_unrestricted": r"R_R^2",
16251626
"T": "T",
16261627
})
16271628
display_table(pred_pretty, fmt={
16281629
r"\hat{\alpha}": "{:.4f}",
16291630
r"\mathrm{Var}(\hat E[X_t\mid\psi_{t-1}])": "{:.6f}",
16301631
r"\mathrm{Var}(\hat E[R_t\mid\psi_{t-1}])": "{:.6f}",
16311632
r"\hat{\alpha}^2\,\mathrm{Var}(\hat E[X_t\mid\psi_{t-1}])": "{:.6f}",
1632-
r"$R_X^2$": "{:.4f}",
1633-
r"$R_R^2$": "{:.4f}",
1633+
r"R_X^2": "{:.4f}",
1634+
r"R_R^2": "{:.4f}",
16341635
"T": "{:.0f}",
16351636
})
16361637
```
@@ -1749,17 +1750,17 @@ tbill_pred_pretty = tbill_pred_df[
17491750
"var_pred_x": r"\mathrm{Var}(\hat E[X_t\mid\psi_{t-1}])",
17501751
"var_pred_r": r"\mathrm{Var}(\hat E[R_t\mid\psi_{t-1}])",
17511752
"alpha2_var_pred_x": r"\hat{\alpha}^2\,\mathrm{Var}(\hat E[X_t\mid\psi_{t-1}])",
1752-
"r2_x_unrestricted": r"$R_X^2$",
1753-
"r2_r_unrestricted": r"$R_R^2$",
1753+
"r2_x_unrestricted": r"R_X^2",
1754+
"r2_r_unrestricted": r"R_R^2",
17541755
"T": "T",
17551756
})
17561757
display_table(tbill_pred_pretty, fmt={
17571758
r"\hat{\alpha}": "{:.4f}",
17581759
r"\mathrm{Var}(\hat E[X_t\mid\psi_{t-1}])": "{:.6f}",
17591760
r"\mathrm{Var}(\hat E[R_t\mid\psi_{t-1}])": "{:.6f}",
17601761
r"\hat{\alpha}^2\,\mathrm{Var}(\hat E[X_t\mid\psi_{t-1}])": "{:.6f}",
1761-
r"$R_X^2$": "{:.4f}",
1762-
r"$R_R^2$": "{:.4f}",
1762+
r"R_X^2": "{:.4f}",
1763+
r"R_R^2": "{:.4f}",
17631764
"T": "{:.0f}",
17641765
})
17651766
```

0 commit comments

Comments
 (0)