{"id":26554012,"url":"https://github.com/beliavsky/garch","last_synced_at":"2025-06-15T14:09:18.973Z","repository":{"id":277925399,"uuid":"928477622","full_name":"Beliavsky/GARCH","owner":"Beliavsky","description":"Simulation and estimation of ARCH and GARCH processes, used to model the time-varying standard deviation (volatility) of asset returns, with conditional distributions such as the normal, Laplace, and Student t.","archived":false,"fork":false,"pushed_at":"2025-03-14T02:42:27.000Z","size":226,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-14T03:28:53.472Z","etag":null,"topics":["finance","gjr-garch","laplace-distribution","monte-carlo","nelder-mead","normal-distribution","probability-distribution","quantitative-finance","simulation","t-distribution","volatility","volatility-modeling"],"latest_commit_sha":null,"homepage":"","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Beliavsky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-06T17:51:24.000Z","updated_at":"2025-03-14T02:42:30.000Z","dependencies_parsed_at":"2025-02-17T03:31:13.492Z","dependency_job_id":null,"html_url":"https://github.com/Beliavsky/GARCH","commit_stats":null,"previous_names":["beliavsky/garch"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beliavsky%2FGARCH","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beliavsky%2FGARCH/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beliavsky%2FGARCH/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Beliavsky%2FGARCH/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Beliavsky","download_url":"https://codeload.github.com/Beliavsky/GARCH/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244937744,"owners_count":20535124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["finance","gjr-garch","laplace-distribution","monte-carlo","nelder-mead","normal-distribution","probability-distribution","quantitative-finance","simulation","t-distribution","volatility","volatility-modeling"],"created_at":"2025-03-22T09:38:45.277Z","updated_at":"2025-03-22T09:38:45.771Z","avatar_url":"https://github.com/Beliavsky.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"## GJR-GARCH Simulation and Estimation\n\nThe program `xgjr_garch.f90` simulates 10000 observations of a GJR-GARCH(1,1) process and then fits a GJR-GARCH model to the simulated returns. The [GJR-GARCH](https://frds.io/algorithms/gjr-garch/) model \"extends the basic GARCH(1,1) by accounting for leverage effects, where bad news (negative returns) has a greater impact on volatility than good news.\" Other programs fit ARCH and GARCH models to financial returns, computed from daily ETF closing prices in `spy_efa_eem_tlt.csv`, with some results [here](https://github.com/Beliavsky/GARCH/blob/main/etf_garch_results.md).\n\n### Code Overview\n\n- **Simulation:**  \n  The program generates 10,000 observations from a GJR-GARCH process using the true parameters.\n\n- **Estimation:**  \n  The model is then fitted to the simulated returns using the Nelder-Mead algorithm. The estimated parameters, negative log-likelihood, and other diagnostic statistics are output.\n\n- **Diagnostics:**  \n  The output includes basic statistics (mean, standard deviation, skewness, kurtosis, min, and max) for both the true conditional standard deviations (`sigma`) and the estimated standard deviations (`sigma_est`).  \n  Additional diagnostics include:\n  - Kurtosis of returns and standardized returns.\n  - Autocorrelation function (ACF) of squared returns and of the squared standardized returns.\n  - Correlation between the true and estimated volatilities.\n\n## Explanation of Sample Output in `results.txt`\n\n### 1. Model Specification\n\n- **GARCH Model:**  \n  The selected model is printed as **gjr_garch**.\n  \n- **Conditional Distribution:**  \n  The returns are modeled using a **normal** distribution.\n\n### 2. True and Estimated Parameters\n\nThe following table compares the true parameters with the estimated parameters obtained from fitting the model:\n\n| Parameter | True Value | Estimated Value |\n|-----------|------------|-----------------|\n| **mu**    | 0.000000   | -0.017736       |\n| **omega** | 0.100000   | 0.117329        |\n| **alpha** | 0.100000   | 0.087711        |\n| **gamma** | 0.100000   | 0.101340        |\n| **beta**  | 0.800000   | 0.800561        |\n\nThis close agreement indicates that the estimation procedure is performing well.\n\n### 3. Log-Likelihood\n\n- The log-likelihood is reported as **-16677.550339**.  \n- The value computed by the negative log-likelihood function matches this value, confirming the consistency of the likelihood calculation.\n\n### 4. Volatility Statistics\n\n- **True Volatility (`sigma`):**  \n  Basic statistics (mean, standard deviation, skew, kurtosis, min, and max) are computed for the simulated conditional standard deviation. For example, the mean is approximately 1.321965 with a standard deviation of 0.363676.\n\n- **Estimated Volatility (`sigma_est`):**  \n  The corresponding statistics for the estimated volatilities are nearly identical to the true values (e.g., mean ≈ 1.319146), indicating a good model fit.\n\n### 5. Additional Diagnostics\n\n- **Kurtosis:**  \n  The kurtosis of the raw returns is near unity, while the kurtosis of the standardized returns (both ret/sigma and ret/sigma_est) is close to zero. This suggests that the model has successfully normalized the returns.\n\n- **Correlation:**  \n  The correlation between `sigma` and `sigma_est` is extremely high (≈ 0.999808), demonstrating that the estimated volatility closely tracks the true volatility.\n\n- **Autocorrelation Function (ACF):**  \n  - The ACF of squared returns shows moderate autocorrelation at low lags, a common sign of volatility clustering.  \n  - In contrast, the ACF of the squared standardized returns (ret/sigma_est)^2 is near zero, confirming that the model has effectively removed the time-dependence in the volatility.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeliavsky%2Fgarch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeliavsky%2Fgarch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeliavsky%2Fgarch/lists"}