{"id":14989246,"url":"https://github.com/jdmaturen/shifted_beta_geometric_py","last_synced_at":"2025-04-12T00:31:55.582Z","repository":{"id":11188708,"uuid":"13568309","full_name":"jdmaturen/shifted_beta_geometric_py","owner":"jdmaturen","description":"An implementation of the shifted-beta-geometric (sBG) model from Fader and Hardie's \"How to Project Customer Retention\" (2006)","archived":false,"fork":false,"pushed_at":"2020-10-25T00:27:05.000Z","size":124,"stargazers_count":55,"open_issues_count":4,"forks_count":21,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T20:51:12.407Z","etag":null,"topics":["customer-retention","fader","hardie","numpy","python","sbg","scipy"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jdmaturen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-10-14T17:39:05.000Z","updated_at":"2025-02-03T11:32:29.000Z","dependencies_parsed_at":"2022-09-11T14:31:26.164Z","dependency_job_id":null,"html_url":"https://github.com/jdmaturen/shifted_beta_geometric_py","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdmaturen%2Fshifted_beta_geometric_py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdmaturen%2Fshifted_beta_geometric_py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdmaturen%2Fshifted_beta_geometric_py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdmaturen%2Fshifted_beta_geometric_py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jdmaturen","download_url":"https://codeload.github.com/jdmaturen/shifted_beta_geometric_py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501383,"owners_count":21114665,"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":["customer-retention","fader","hardie","numpy","python","sbg","scipy"],"created_at":"2024-09-24T14:17:56.036Z","updated_at":"2025-04-12T00:31:55.241Z","avatar_url":"https://github.com/jdmaturen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sBG model of customer retention\n\nA python implementation of the shifted-beta-geometric (sBG) model from Fader and Hardie's [\"How to Project Customer\nRetention\" (2006)](http://www.brucehardie.com/papers/021/sbg_2006-05-30.pdf).\n\nImportant note to modelers: amongst other presumptions, see §3 of the paper, sBG is only applicable to discrete,\ncontractual customer relationships:\n\n\u003cimg src=\"customer_bases.png\" alt=\"Custer Bases Diagram\" width=363 height=321\u003e\n\nFigure Source: [\"Probability Models for Customer-Base Analysis\" (Fader and Hardie 2009)](https://marketing.wharton.upenn.edu/files/?whdmsaction=public:main.file\u0026amp;fileID=341)\n\n## Example\n\n```python\nfrom shifted_beta_geometric import derl, fit, predicted_survival\n\n# measured percentage of cohort that survives over time\nexample_data = [.869, .743, .653, .593, .551, .517, .491]\n\n# fit our observed data to the sBG model, which returns the parameters alpha and beta\nalpha, beta = fit(example_data)\n\n# predict the next 5 time samples:\nfuture = predicted_survival(alpha, beta, len(example_data) + 5)[-5:]\n\n# future = [0.460, 0.436, 0.414, 0.395, 0.378]\n\n# compute the discounted expected residual lifetime (DERL) for the survivors\n# of this cohort at point in time t:\ndiscount = 0.10  # rate at which we discount future revenue\n                 # to get value in today's terms, e.g. 10%/year\nt = len(example_data)\nresidual_cohort_lifetime = derl(alpha, beta, discount, t)\n\n# residual_cohort_lifetime = 7.530\n\n# if our average revenue per period per customer is a constant v_avg,\n# to get the residual customer lifetime value (CLV) of this cohort\n# we simply multiply the residual_cohort_lifetime by v_avg:\n\nv_avg = 10\nresidual_cohort_clv = residual_cohort_lifetime * v_avg\n\n# thus residual_cohort_clv = $75.30 per customer in this cohort\n```\n\n## Requirements\nsBG requires `numpy` and `scipy` for fitting and the gauss hypergeometric function.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdmaturen%2Fshifted_beta_geometric_py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjdmaturen%2Fshifted_beta_geometric_py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdmaturen%2Fshifted_beta_geometric_py/lists"}