Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multivariate Vasicek model example #28

Open
SamDuffield opened this issue May 30, 2024 · 6 comments
Open

Add multivariate Vasicek model example #28

SamDuffield opened this issue May 30, 2024 · 6 comments
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@SamDuffield
Copy link
Contributor

It would be awesome if we can use thermox.log_prob and gradient ascent to fit a multivariate Vasicek model to some real data

@SamDuffield SamDuffield added documentation Improvements or additions to documentation good first issue Good for newcomers labels May 30, 2024
@KaelanDt
Copy link
Contributor

@SamDuffield
Copy link
Contributor Author

At the end of this notebook there is an example for bond pricing with the Vasicek model https://github.com/cantaro86/Financial-Models-Numerical-Methods/blob/afd0e5340502f0056aec00b594c64928b34f4bcb/6.1%20Ornstein-Uhlenbeck%20process%20and%20applications.ipynb

This seems to be univariate right? But yeah might be a good resource for inspiration for extending to multivariate case

@zauberresonator
Copy link

At the end of this notebook there is an example for bond pricing with the Vasicek model https://github.com/cantaro86/Financial-Models-Numerical-Methods/blob/afd0e5340502f0056aec00b594c64928b34f4bcb/6.1%20Ornstein-Uhlenbeck%20process%20and%20applications.ipynb

This seems to be univariate right? But yeah might be a good resource for inspiration for extending to multivariate case

It will be kind of messy if you are trying to obtain some substantial amount of real bond data without access to certain databases (e.g., WRDS (TRACE) database). That said, you can check out the datasets here at Open Source Bond Asset Pricing - https://openbondassetpricing.com/data/ - and I recommend skimming through some Fabozzi to understand what the variables mean in the data files.

@zauberresonator
Copy link

At the end of this notebook there is an example for bond pricing with the Vasicek model https://github.com/cantaro86/Financial-Models-Numerical-Methods/blob/afd0e5340502f0056aec00b594c64928b34f4bcb/6.1%20Ornstein-Uhlenbeck%20process%20and%20applications.ipynb

This seems to be univariate right? But yeah might be a good resource for inspiration for extending to multivariate case

What exactly do you mean by a multivariate extension? There is only one short rate modelled in a Vasicek model - presumably you might be thinking of modelling interest rates in different economies (e.g., G7), but then these rates may be highly correlated, so it may be preferable to model and simulate in a more suitable basis where the transformed interest rates are not highly correlated and then transform back to the original interest rates in the end.

@SamDuffield
Copy link
Contributor Author

@zauberresonator thanks for your insight! You clearly are coming from a more financially applied viewpoint than us which is great!

What exactly do you mean by a multivariate extension?

I was thinking that yeah we could have multiple interest rates/economies within the same model and as you say they might be correlated but these correlations would be learnt by having a higher dimensional Vasicek/OU model that includes dense covariances and drift dependencies. I.e. learning numerically how correlated the interest rates are.

@zauberresonator
Copy link

@zauberresonator thanks for your insight! You clearly are coming from a more financially applied viewpoint than us which is great!

What exactly do you mean by a multivariate extension?

I was thinking that yeah we could have multiple interest rates/economies within the same model and as you say they might be correlated but these correlations would be learnt by having a higher dimensional Vasicek/OU model that includes dense covariances and drift dependencies. I.e. learning numerically how correlated the interest rates are.

Wow, that is cool - I have studied the relevant subjects in the context of physics, statistics, and finance in uni before. I will try this out on my own over the holidays, but you can ping me at [email protected] if I can be of help offline. There are a few more things I will note if you are trying this out:
(i) Covariance matrix: typical (high-dimensional) covariance matrix estimation often assumes some form of low-rank structure (revealed through various rank-revealing matrix factorisations) and/or applies some form of regularisation/shrinkage to only use the "important" components; this can be visualised by plotting the eigenvalues (from largest to smallest) for naive and shrunk sample covariance matrices
(ii) Precision matrix: assuming multivariate Gaussian distribution, entry (i,j) of the precision matrix is related to the partial correlation of $x_i$ and $x_j$ conditioning on the other $x_k$ variables and is precisely zero when $x_i$ and $x_j$ are conditionally independent (given the other variables); similar high-dimensional concerns apply to the sample estimate precision matrix
(iii) RMT: naturally, there is all the beautiful results from random matrix theory going back to Wigner, Dyson, and Mehta, but I will be careful before applying those as sanity checks because the relevant limit in this context is $T \rightarrow \infty$, $N \rightarrow \infty$, and $q=\frac{N}{T}=O(1)$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants