Skip to content

Commit d1c75bf

Browse files
committed
Update README.md
1 parent 87cc1c8 commit d1c75bf

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

README.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,29 @@ carries all the relevant variables as atributes:
2626
pip install pyacm
2727
```
2828

29+
# Usage
30+
```python
31+
from pyacm import NominalACM
32+
33+
acm = NominalACM(
34+
curve=yield_curve,
35+
n_factors=5,
36+
)
37+
```
38+
The tricky part of using this model is getting the correct data format. The
39+
`yield_curve` dataframe in the expression above requires:
40+
- Annualized log-yields for zero-coupon bonds
41+
- Observations (index) must be in either monthly or daily frequency
42+
- Maturities (columns) must be equally spaced in **monthly** frequency and start
43+
at month 1. This means that you need to construct a bootstraped curve for every
44+
date and interpolate it at fixed monthly maturities
45+
- Whichever maturity you want to be the longest, your input data should have one
46+
column more. For example, if you want term premium estimate up to the 10-year
47+
yield (120 months), your input data should include maturities up to 121 months.
48+
This is needed to properly compute the returns.
49+
2950
# Examples
51+
3052
The estimates for the US are available on the [NY FED website](https://www.newyorkfed.org/research/data_indicators/term-premia-tabs#/overview).
3153

3254
The jupyter notebook [`example_br`](https://github.com/gusamarante/pyacm/blob/main/example_br.ipynb)
@@ -50,14 +72,6 @@ but I found an earlier version of the paper on SSRN where the authors go deeper
5072
- To get daily / real-time estimates, the factor loadings estimated from the monthly frquency are used to transform the daily data
5173

5274

53-
# Usage
54-
The tricky part of using this model is getting the correct data format:
55-
- The model works with annualized log-yields for zero-coupon bonds
56-
- Observations (index) must be in either monthly or daily frequency
57-
- Maturities (columns) must be equally spaced in **monthly** frequency and start at month 1. This means that you need to construct a bootstraped curve for every date and interpolate it at fixed monthly maturities.
58-
- Whichever maturity you want to be the longest, your input data should have one column more. For example, if you want term premium estimate up to the 10-year yield (120 months), your input data should include maturities up to 121 months. This is needed to properly compute the returns.
59-
60-
6175
# Observations
6276
I am not completely sure that computations in the [inferences attributes][inference_atribute]
6377
are correct. If you find any mistakes, please open a pull request following the contributing

0 commit comments

Comments
 (0)