{"id":14068978,"url":"https://github.com/copenhaver/factoranalysis","last_synced_at":"2025-07-30T05:30:45.662Z","repository":{"id":110989639,"uuid":"87727006","full_name":"copenhaver/factoranalysis","owner":"copenhaver","description":"Alternating minimization approach to factor analysis","archived":false,"fork":false,"pushed_at":"2017-04-12T20:40:06.000Z","size":20,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-04T10:38:47.435Z","etag":null,"topics":["exploratory-data-analysis","factor-analysis","optimization"],"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/copenhaver.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}},"created_at":"2017-04-09T17:40:49.000Z","updated_at":"2020-02-11T04:10:10.000Z","dependencies_parsed_at":"2023-03-13T13:44:47.816Z","dependency_job_id":null,"html_url":"https://github.com/copenhaver/factoranalysis","commit_stats":{"total_commits":12,"total_committers":1,"mean_commits":12.0,"dds":0.0,"last_synced_commit":"cab7c3ceff0ff1e817135b9cdc15cb7a49d94815"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/copenhaver/factoranalysis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copenhaver%2Ffactoranalysis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copenhaver%2Ffactoranalysis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copenhaver%2Ffactoranalysis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copenhaver%2Ffactoranalysis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/copenhaver","download_url":"https://codeload.github.com/copenhaver/factoranalysis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copenhaver%2Ffactoranalysis/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267815187,"owners_count":24148356,"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-07-30T02:00:09.044Z","response_time":70,"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":["exploratory-data-analysis","factor-analysis","optimization"],"created_at":"2024-08-13T07:06:31.167Z","updated_at":"2025-07-30T05:30:45.418Z","avatar_url":"https://github.com/copenhaver.png","language":"R","readme":"### Background\n\nFactor analysis (\"FA\") is a classical technique in multivariate statistics enjoying a rich history dating back over 100 years. In its simplest form, FA focuses on decomposing a given covariance matrix `S` into two respective components: `S=T+P`, where `T` is a (low-rank) positive semidefinite (\"PSD\") matrix (representing the common variances) and `P` is a diagonal matrix with non-negative diagonal entries (representing the individual variances). In reality, this *noiseless* decomposition can often be too restrictive, and so instead it is better to decompose `S` *approximately* as a low-rank matrix `T` plus a diagonal matrix `P`. \n\n### Our approach\n\nThis page contains several sample implementations of an estimation procedure for FA as described in [Bertsimas, Copenhaver, and Mazumder, \"Certifiably Optimal Low Rank Factor Analysis\", Journal of Machine Learning Research 18 (2017) (\"BCM17\")](http://jmlr.org/papers/v18/15-613.html). The approach is based on conditional gradient methods from convex optimization. We provide several sample implementations of Algorithm 1 (see page 13). Given the well-structured nature of the problems solved in Algorithm 1, there are algorithmic improvements that can be made to the implementations here, but these serve as a good starting point.\n\nThe problem that we focus on is the case of *q=1* outlined in BCM17. This special case is known as *Approximate Minimum Rank Factor Analysis*, or MRFA, and takes the form\n```\nminimize\tnuclear_norm( S - ( T + P ) )\nsubject to \tP, T \u003e= 0\n\t\tS - P \u003e= 0\n\t\tP diagonal\n\t\trank(T) \u003c= r\n```\nHere the optimization variables are `T` and `P`; the notation `A \u003e= 0` denotes that a matrix `A` is symmetric positive semidefinite; and the nuclear norm is the sum of the singular values. As shown in BCM17, this can be rewritten exactly as\n```\nminimize\ttrace( W*S - W*P )\nsubject to \tW, P \u003e= 0\n\t\tS - P \u003e= 0\n\t\tP diagonal\n\t\tI - W \u003e= 0\n\t\ttrace(W) = p - r\n```\nwhere `p` is the number of variables (i.e. `S` is a `p` by `p` matrix) and `I` is the `p` by `p` identity matrix.\n\n\nThe resulting algorithm described in BCM17 amounts to an alternating minimization scheme in `W` and `P`.\n\n\n### Implementations\n\nThe two implementations are as follows:\n\n1. [R](./R/)\n\n   This implementation is as described in the paper. In particular, the update with respect to `P`, where `W` is fixed, is solved using the customized ADMM (Section 3.2.2).\n\n\n2. [MATLAB](./matlab/)\n\n   This implementation relies on [`cvx`](https://cvxr.com/cvx/ \"CVX\") and highlights the simplicity of the alternating minimization approach.\n\n\n\n### Citation\n\nIf you would like to cite this work, please use the following citation for BCM17:\n```\n@article{bcm17,\n  author  = {Dimitris Bertsimas and Martin S. Copenhaver and Rahul Mazumder},\n  title   = {Certifiably Optimal Low Rank Factor Analysis},\n  journal = {Journal of Machine Learning Research},\n  year    = {2017},\n  volume  = {18},\n  number  = {29},\n  pages   = {1-53},\n  url     = {http://jmlr.org/papers/v18/15-613.html}\n}\n```\n\n","funding_links":[],"categories":["R"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcopenhaver%2Ffactoranalysis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcopenhaver%2Ffactoranalysis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcopenhaver%2Ffactoranalysis/lists"}