{"id":34253737,"url":"https://github.com/statcompute/py_vsk","last_synced_at":"2025-12-16T11:54:04.856Z","repository":{"id":57458406,"uuid":"297107021","full_name":"statcompute/py_vsk","owner":"statcompute","description":"A Collection of Python Functions for Vasicek Distribution","archived":false,"fork":false,"pushed_at":"2020-11-08T15:39:13.000Z","size":77,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-27T20:58:41.260Z","etag":null,"topics":["creditrisk","loss-distribution","python-functions","vasicek-distribution"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/statcompute.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-20T15:35:23.000Z","updated_at":"2024-07-22T14:46:40.000Z","dependencies_parsed_at":"2022-09-09T22:50:21.057Z","dependency_job_id":null,"html_url":"https://github.com/statcompute/py_vsk","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/statcompute/py_vsk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statcompute%2Fpy_vsk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statcompute%2Fpy_vsk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statcompute%2Fpy_vsk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statcompute%2Fpy_vsk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/statcompute","download_url":"https://codeload.github.com/statcompute/py_vsk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statcompute%2Fpy_vsk/sbom","scorecard":{"id":846709,"data":{"date":"2025-08-11","repo":{"name":"github.com/statcompute/py_vsk","commit":"bfca0b4327b3b4b1d9c6cc244a8c61be454ef492"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-23T21:39:24.258Z","repository_id":57458406,"created_at":"2025-08-23T21:39:24.258Z","updated_at":"2025-08-23T21:39:24.258Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27763657,"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","status":"online","status_checked_at":"2025-12-16T02:00:10.477Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["creditrisk","loss-distribution","python-functions","vasicek-distribution"],"created_at":"2025-12-16T11:54:04.174Z","updated_at":"2025-12-16T11:54:04.849Z","avatar_url":"https://github.com/statcompute.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n### \u003cp align=\"center\"\u003e PY_VSK \u003c/p\u003e\n### \u003cp align=\"center\"\u003e - A Collection of Python Functions for Vasicek Distribution  \u003c/p\u003e\n\n#### Introduction\n\nIn the context of statistics, the Vasicek distribution is a continuous distribution governing the open interval between 0 and 1 with two parameters, namely Rho and P, which is similar to the Beta and Kumaraswamy distributions. \n\nThe Vasicek distribution has often been used to describe the portfolio credit loss in the development of Economic Capital models. The py\\_vsk package is a collection of miscellaneous python functions related to the Vasicek distribution with the intent to make the lives of risk modelers easier.\n\n\n#### Core Functions\n\n```\npy_vsk\n  |-- vsk_mle()   : Estimates Vasicek parameters by using MLE.\n  |-- vsk_imm()   : Estimates Vasicek parameters by using indirect moment matching.\n  |-- vsk_dmm()   : Estimates Vasicek parameters by using direct moment matching.\n  |-- vsk_qbe()   : Estimates Vasicek parameters by using quantile-based estimator.\n  |-- vsk_Rho()   : Estimates the Rho parameter by assuming P known and varying.\n  |-- vsk_pdf()   : Calculates the probability density function of Vasicek.\n  |-- vsk_cdf()   : Calculates the probability cumulative function of Vasicek.\n  |-- vsk_ppf()   : Calculates the percentile point function (CDF inverse) of Vasicek.\n  |-- vsk_rvs()   : Generates random numbers following the Vasicek distribution.\n  |-- get_Rho()   : Solves for the Rho parameter such that vsk_cdf(x, Rho, P) = Alpha.\n  |-- gof_ks()    : Performs the Kolmogorov-Smirnov GoF test for the Vasicek distribution.\n  `-- gof_chisq() : Performs the Chi-Square GoF test for the Vasicek distribution.\n```\n\n#### Example\n\nWhile future default rates cannot be predicted with certainty, the probability of default rates can be assessed based on the appropriate statistical distribution. \n\nBelow is the list of delinquent rates for 100 largest banks in the last 20 years (https://www.federalreserve.gov/releases/chargeoff/deltop100nsa.htm). \n```python\ndf = [0.0171, 0.0214, 0.0275, 0.0317, 0.0400, 0.0533, 0.0692, 0.0901, 0.0984, 0.1051, \n      0.1117, 0.0684, 0.0317, 0.0190, 0.0158, 0.0139, 0.0179, 0.0200, 0.0241, 0.0264]\n```\nBased on the above, we can estimate parameters of the corresponding Vasicek distribution. While the P parameter shows the long-term average of delinquent rates, the Rho parameter describes the degree of association with systematic risk factors.  \n```python\nimport py_vsk\npy_vsk.vsk_mle(df)\n# {'Rho': 0.0939762321, 'P': 0.0446574471}\n```\nThe delinquent rate reached the highest of 11.17% in 2009 and is equivalent to ~96%ile in the corresponding Vasicek distribution, suggesting that the 2009 downturn is an 1-in-25 event.\n```python\npy_vsk.vsk_cdf([max(df)], 0.0939762321, 0.0446574471)\n# [{'x': 0.1117, 'cdf': 0.9609532701414676}]\n```\nIn addition, the result below shows that there is an 1% chance that the delinquent rate could be as high as 15%. \n```python\npy_vsk.vsk_ppf([0.99], 0.0939762321, 0.0446574471)\n# [{'Alpha': 0.99, 'ppf': 0.15016266823403973}]\n```\n\n#### Reference\n\nTasche, Dirk. (2008). The Vasicek Distribution.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatcompute%2Fpy_vsk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstatcompute%2Fpy_vsk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatcompute%2Fpy_vsk/lists"}