{"id":15900449,"url":"https://github.com/simonsays1980/finmix","last_synced_at":"2025-08-01T07:31:03.285Z","repository":{"id":46107697,"uuid":"394372516","full_name":"simonsays1980/finmix","owner":"simonsays1980","description":"An R package for Bayesian estimation of finite mixture distributions. ","archived":false,"fork":false,"pushed_at":"2021-11-22T09:50:17.000Z","size":1838,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T14:05:45.327Z","etag":null,"topics":["bayesian","bayesian-inference","finite-mixture-distributions","r","r-package","statistics"],"latest_commit_sha":null,"homepage":"","language":"R","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/simonsays1980.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}},"created_at":"2021-08-09T16:56:49.000Z","updated_at":"2023-09-03T08:03:09.000Z","dependencies_parsed_at":"2022-08-30T18:01:29.217Z","dependency_job_id":null,"html_url":"https://github.com/simonsays1980/finmix","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/simonsays1980/finmix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonsays1980%2Ffinmix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonsays1980%2Ffinmix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonsays1980%2Ffinmix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonsays1980%2Ffinmix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonsays1980","download_url":"https://codeload.github.com/simonsays1980/finmix/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonsays1980%2Ffinmix/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268185559,"owners_count":24209392,"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-08-01T02:00:08.611Z","response_time":67,"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":["bayesian","bayesian-inference","finite-mixture-distributions","r","r-package","statistics"],"created_at":"2024-10-06T11:00:28.493Z","updated_at":"2025-08-01T07:31:02.742Z","avatar_url":"https://github.com/simonsays1980.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![R-CMD-check](https://github.com/simonsays1980/finmix/actions/workflows/r-check-package.yml/badge.svg)](https://github.com/simonsays1980/finmix/actions/workflows/r-check-package.yml) [![GPLv3 license](https://img.shields.io/badge/License-GPLv3-blue.svg)](http://perso.crans.org/besson/LICENSE.html) [![GitHub tag](https://img.shields.io/github/tag/simonsays1980/finmix.svg)](https://GitHub.com/simonsays1980/finmix/tags/)\n[![Linux](https://svgshare.com/i/Zhy.svg)](https://svgshare.com/i/Zhy.svg) [![macOS](https://svgshare.com/i/ZjP.svg)](https://svgshare.com/i/ZjP.svg) [![Windows](https://svgshare.com/i/ZhY.svg)](https://svgshare.com/i/ZhY.svg)\n\n\n\n\n\n# finmix\n**An R package for Bayesian estimation of finite mixture distributions** \n\nThe package uses heavily C++ code to enable high performance MCMC sampling. \nTo simplify handling for users each distribution comes along with some support \nfunctions that create required objects and starting parameters. As a result a \nuser can perform Bayesian parameter estimation in only a few lines. The following \nmixtures are available: \n* Binomial, \n* Exponential, \n* Normal, \n* Multivariate Normal, \n* Poisson,\n* Condiitonal Poisson\n* Student-t, and \n* Multivariate Student-t.\n\n## Literature and implementations\nThe methods used in this package are based on the major literature on the Bayesian estimation \nof finite mixture distributions, namely \n\n*Frühwirth-Schnatter, Sylvia (2006), \"Finite Mixture and Markov Switching Models\", \nSpringer Series in Statistics ([link](https://link.springer.com/book/10.1007/978-0-387-35768-3))*.\n\nThe code of this package is related to the `bayesf` package in `Matlab` written by Sylvia \nFrühwirth-Schnatter herself. Due to the C++ extensions in this package using `Rcpp` the \n`R` implementation is almost 200x times faster than the `Matlab` version. A single MCMC run \nwith 11000 iterations is usually performed within 2-3 seconds. \n\n## Installation\nThe package can be installed directly from GitHub by using the function `install_github()` \nin the `devtools` package. The package passed all checks from R CMD check on all major \nplatforms and hence, should be installable on MacOS, Windows, and Linux. Be sure that you \ninstalled appropriate developer tools for your platform as a C++ compiler for the source \ncode is needed. \n\n### MacOS\nFor MacOS the XCode Command Line Tools are needed. You should have installed these when \ninstalling `R`. See the [MacOSX-FAQ](https://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html#Installation-of-source-packages) \nfor more information on how to install source packages on MacOS.\n\n### Windows\nFor Windows the [`rtools`](https://cran.r-project.org/bin/windows/Rtools/) package is needed. \nFollow the link and install this package, if you have not installed it, yet. \n\n## Quick start\nAs a quick start choose a *Poisson* mixture with two components and perform MCMC sampling: \n```\n# Load the package.\nlibrary(finmix)\n# Define the finite mixture model (two components). \nf_model \u003c- model(dist=\"poisson\", K=2, par=list(lambda=c(.3, .7)))\n\n# Simulate data from this mixture distribution.\nf_data \u003c- simulate(f_model)\n\n# Define the hyperparameters for MCMC sampling.\nf_mcmc \u003c- mcmc()\n\n# Define the prior distribution for MCMC sampling.\nf_prior \u003c- priordefine(f_data, f_model)\n\n# Set up all parameters for MCMC sampling.\n(f_data ~ f_model ~ f_mcmc) %=% mcmcstart(f_data, f_model, f_mcmc)\n\n# Perform MCMC sampling.\nf_output \u003c- mixturemcmc(f_data, f_model, f_prior, f_mcmc)\nf_output\n```\n\nTo estimate the parameters you simply call the function `mcmcestimate()` \non the output from MCMC sampling: \n```\nf_estimates \u003c- mcmcestimate(f_output)\nf_estimates\n```\n### Further functionalities\nThe package comes with many auxiliary functions for plotting (e.g. `plotTraces()` \nto plot MCMC traces from MCMC outputs), for subchaining (`subseq()`), for \nswapping elements (`swapElements()`), or for relabeling components (`mcmcpermute()`). \nSee the documentation for further reading. \n\n## Some more information\nThis is a package worked on for years and still not fully implemented. As it is still \nmaintained by a single author, please by patient with issues. \n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonsays1980%2Ffinmix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonsays1980%2Ffinmix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonsays1980%2Ffinmix/lists"}