# bayesfm - Bayesian Fama-MacBeth
Implementation of ["Bayesian Fama-MacBeth Regressions"](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4989615) from Bryzgalova, Huang and Julliard (2024).
As presented by the authors, this methodology provides reliable risk premia estimates for both tradable and nontradable factors,
detects those weakly identified, delivers valid credible intervals for all objects of interest, and is intuitive, fast and simple to implement.
## Installation
```bash
pip install bayesfm
```
## Usage
There is a self-contained [example file](https://github.com/gusamarante/bayesfm/blob/main/example.py) using the Fama-French 25 sorted portfolios and their 5 factors.
There are 3 classes available:
- `BFM`: Bayesian Fama-MacBeth
- `BFMGLS`: Bayesian Fama-MacBeth with the GLS precision matrix for the cross-sectional step
- `BFMOMIT`: Bayesian Fama-MacBeth with omitted factors
- As noted by the authors, the use of this model requires us to include a sufficient number of latent factors in the cross-sectional step, which is chosen with the `p` argument of this class
All three class save the draws of all elements of interest as attributes, and have a method called `plot_lambda`, which plots the posteriors of the risk premia parameters.
This method outputs the chart below, where the blue density are the posterior draws and the orange lines are the canonical Fama-MacBeth two-pass OLS regression estiamtes.
<p align="center">
<img src="https://github.com/gusamarante/bayesfm/blob/main/images/bfm_lambda_posterior.png?raw=true" alt="Risk Premia Posterior"/>
</p>
Raw data
{
"_id": null,
"home_page": null,
"name": "bayesfm",
"maintainer": "Gustavo Amarante",
"docs_url": null,
"requires_python": null,
"maintainer_email": "developer@dsgepy.com",
"keywords": "asset pricing, factor models, risk premia, bayesian methods",
"author": "Svetlana Bryzgalova, Jiantao Huang, Christian Julliard",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/04/36/759b38fbcb2ea2dc08502992c2464541eb12a1c60d7db448156a877046e3/bayesfm-0.2.2.tar.gz",
"platform": null,
"description": "\n# bayesfm - Bayesian Fama-MacBeth\n\nImplementation of [\"Bayesian Fama-MacBeth Regressions\"](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4989615) from Bryzgalova, Huang and Julliard (2024).\nAs presented by the authors, this methodology provides reliable risk premia estimates for both tradable and nontradable factors, \ndetects those weakly identified, delivers valid credible intervals for all objects of interest, and is intuitive, fast and simple to implement.\n\n## Installation\n```bash\npip install bayesfm\n```\n\n## Usage\nThere is a self-contained [example file](https://github.com/gusamarante/bayesfm/blob/main/example.py) using the Fama-French 25 sorted portfolios and their 5 factors.\n\nThere are 3 classes available:\n- `BFM`: Bayesian Fama-MacBeth\n- `BFMGLS`: Bayesian Fama-MacBeth with the GLS precision matrix for the cross-sectional step\n- `BFMOMIT`: Bayesian Fama-MacBeth with omitted factors\n - As noted by the authors, the use of this model requires us to include a sufficient number of latent factors in the cross-sectional step, which is chosen with the `p` argument of this class\n\nAll three class save the draws of all elements of interest as attributes, and have a method called `plot_lambda`, which plots the posteriors of the risk premia parameters.\nThis method outputs the chart below, where the blue density are the posterior draws and the orange lines are the canonical Fama-MacBeth two-pass OLS regression estiamtes.\n\n<p align=\"center\">\n <img src=\"https://github.com/gusamarante/bayesfm/blob/main/images/bfm_lambda_posterior.png?raw=true\" alt=\"Risk Premia Posterior\"/>\n</p>\n\n",
"bugtrack_url": null,
"license": null,
"summary": "Bayesian Fama-MacBeth Regressions",
"version": "0.2.2",
"project_urls": null,
"split_keywords": [
"asset pricing",
" factor models",
" risk premia",
" bayesian methods"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cee0dff20d608010597de58284b24f05ff19af463bd7db4eadf49211bf662842",
"md5": "5ee97a3169e62fdef2ecacc2185da28e",
"sha256": "97fb217d7797029be2224648a2fec3853be85c90c0d1bf04990fd0b5ffb7ad05"
},
"downloads": -1,
"filename": "bayesfm-0.2.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5ee97a3169e62fdef2ecacc2185da28e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6156,
"upload_time": "2024-11-14T12:16:18",
"upload_time_iso_8601": "2024-11-14T12:16:18.906531Z",
"url": "https://files.pythonhosted.org/packages/ce/e0/dff20d608010597de58284b24f05ff19af463bd7db4eadf49211bf662842/bayesfm-0.2.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0436759b38fbcb2ea2dc08502992c2464541eb12a1c60d7db448156a877046e3",
"md5": "2f61a47829c404be09f633634656ec74",
"sha256": "2cc040dced74a59b6ea53112b361eb02722983072c3c6adfbcbead9c7dbccf1d"
},
"downloads": -1,
"filename": "bayesfm-0.2.2.tar.gz",
"has_sig": false,
"md5_digest": "2f61a47829c404be09f633634656ec74",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5565,
"upload_time": "2024-11-14T12:16:20",
"upload_time_iso_8601": "2024-11-14T12:16:20.595811Z",
"url": "https://files.pythonhosted.org/packages/04/36/759b38fbcb2ea2dc08502992c2464541eb12a1c60d7db448156a877046e3/bayesfm-0.2.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-14 12:16:20",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "bayesfm"
}