{"id":32199421,"url":"https://github.com/egeminiani/penfa","last_synced_at":"2025-10-22T03:15:34.603Z","repository":{"id":44646061,"uuid":"381078136","full_name":"egeminiani/penfa","owner":"egeminiani","description":"R package for penalized factor analysis via trust-region algorithm and automatic multiple tuning parameter selection","archived":false,"fork":false,"pushed_at":"2022-02-02T11:23:54.000Z","size":3863,"stargazers_count":3,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-19T03:16:08.553Z","etag":null,"topics":["factor-analysis","lasso","latent-variables","multiple-group","optimization","penalization","psychometrics"],"latest_commit_sha":null,"homepage":"https://egeminiani.github.io/penfa/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/egeminiani.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-28T15:25:10.000Z","updated_at":"2023-10-30T02:45:18.000Z","dependencies_parsed_at":"2022-08-21T00:40:33.646Z","dependency_job_id":null,"html_url":"https://github.com/egeminiani/penfa","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/egeminiani/penfa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egeminiani%2Fpenfa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egeminiani%2Fpenfa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egeminiani%2Fpenfa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egeminiani%2Fpenfa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/egeminiani","download_url":"https://codeload.github.com/egeminiani/penfa/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egeminiani%2Fpenfa/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280371890,"owners_count":26319523,"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-10-22T02:00:06.515Z","response_time":63,"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":["factor-analysis","lasso","latent-variables","multiple-group","optimization","penalization","psychometrics"],"created_at":"2025-10-22T03:15:32.174Z","updated_at":"2025-10-22T03:15:34.599Z","avatar_url":"https://github.com/egeminiani.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# penfa\n\n\u003c!-- badges: start --\u003e\n\n[![minimal R\nversion](https://img.shields.io/badge/R%3E%3D-3.5.0-6666ff.svg)](https://cran.r-project.org/)\n[![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html)\n[![Last-changedate](https://img.shields.io/badge/last%20change-`r gsub('-', '--', Sys.Date())`-brightgreen.svg)](https://github.com/egeminiani/penfa/commits/main)\n[![Website](https://img.shields.io/badge/website-penfa-orange.svg?colorB=E91E63)](https://egeminiani.github.io/penfa/)\n[![Licence](https://img.shields.io/badge/licence-GPL--3-orange.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html)\n[![R-CMD-check](https://github.com/egeminiani/penfa/workflows/R-CMD-check/badge.svg)](https://github.com/egeminiani/penfa/actions)\n\u003c!-- badges: end --\u003e\n\n### Overview\n\nAn R package for estimating single- and multiple-group penalized factor models\nvia a trust-region algorithm with integrated automatic multiple tuning parameter\nselection (Geminiani et al., 2021). Supported penalties include lasso, adaptive\nlasso, scad, mcp, and ridge.\n\n### Installation\n\n\nYou can install the released version of penfa from CRAN with:\n\n``` r\ninstall.packages(\"penfa\")\n```\n\nAnd the development version from [GitHub](https://github.com/) with:\n\n``` r\n# install.packages(\"devtools\")\ndevtools::install_github(\"egeminiani/penfa\")\n```\n### Example\n\nThis is a basic example showing how to fit a *PENalized Factor Analysis* model\nwith the alasso penalty and the automatic tuning procedure. A shrinkage penalty \nis applied to the whole factor loading matrix.\n\nLet's load the data (see `?ccdata` for details).\n\n```{r data}\nlibrary(penfa)\ndata(ccdata)\n```\n\n\u003cfont size=\"4\"\u003e**Step 1**\u003c/font\u003e : specify the model syntax\n\n```{r syntax}\nsyntax = 'help  =~   h1 + h2 + h3 + h4 + h5 + h6 + h7 + 0*v1 + v2 + v3 + v4 + v5\n          voice =~ 0*h1 + h2 + h3 + h4 + h5 + h6 + h7 +   v1 + v2 + v3 + v4 + v5'\n```\n\n\u003cfont size=\"4\"\u003e**Step 2**\u003c/font\u003e: fit the model\n\n```{r fit}\nalasso_fit \u003c- penfa(model  = syntax,\n                    data   = ccdata,\n                    std.lv = TRUE,\n                    pen.shrink = \"alasso\")\n```\n\n\n```{r show}\nalasso_fit\n```\n\n\u003cfont size=\"4\"\u003e**Step 3**\u003c/font\u003e: inspect the results\n\n```{r summary}\nsummary(alasso_fit)\n```\n\n\n### Vignettes and Tutorials\n\n* See `vignette(\"automatic-tuning-selection\")` for the estimation of a penalized\nfactor model with lasso and alasso penalties. The tuning parameter producing the\noptimal amount of sparsity in the factor loading matrix is found through the\nautomatic tuning procedure.\n \n* See `vignette(\"grid-search-tuning-selection\")` for the estimation of a\npenalized factor model with scad and mcp penalties. A grid search is conducted,\nand the optimal tuning parameter is the one generating the penalized model with\nthe lowest GBIC (Generalized Bayesian Information Criterion).\n\n* See [\"multiple-group-analysis\"](https://egeminiani.github.io/penfa/articles/articles/multiple-group-analysis.html) for the estimation of a multiple-group penalized factor model \nwith the alasso penalty. This model encourages sparsity in the loading matrices \nand cross-group invariance of loadings and intercepts. The automatic multiple \ntuning parameter procedure is employed for finding the optimal tuning parameter \nvector.\n\n* See [\"plotting-penalty-matrix\"](https://egeminiani.github.io/penfa/articles/articles/plotting-penalty-matrix.html) for details on how to produce interactive plots of the penalty matrices.\n\n\n### Literature\n\n* Geminiani, E., Marra, G., \u0026 Moustaki, I. (2021). \"Single- and Multiple-Group\nPenalized Factor Analysis: A Trust-Region Algorithm Approach with Integrated\nAutomatic Multiple Tuning Parameter Selection.\" Psychometrika, 86(1), 65-95. [https://doi.org/10.1007/s11336-021-09751-8](https://doi.org/10.1007/s11336-021-09751-8)\n\n* Geminiani, E. (2020). \"A Penalized Likelihood-Based Framework for Single and\nMultiple-Group Factor Analysis Models.\" PhD thesis, University of Bologna.\n[http://amsdottorato.unibo.it/9355/](http://amsdottorato.unibo.it/9355/).\n\n\n### How to cite\n\n```{r citation, echo=FALSE}\nprint(citation(\"penfa\"), bibtex = TRUE)\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegeminiani%2Fpenfa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fegeminiani%2Fpenfa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegeminiani%2Fpenfa/lists"}