Factanal
Python wrapper replicating the known factor analysis output from the factanal R function. The only supported input is a pandas data frame. Formulas as input are currently not supported. A covariance matrix is always computed from the input data frame. Setting control variables for maximum likelihood estimation is currently not supported.
Further information on R's factanal function for factor analysis: https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/factanal
More information on the factanal output and examples: https://data.library.virginia.edu/getting-started-with-factor-analysis/
Example
import pandas as pd
import random
from factanal.wrapper import factanal
pdf = pd.DataFrame({"v1": [random.randint(0, 100) for _ in range (30)],
"v2": [random.randint(0, 100) for _ in range (30)],
"v3": [random.randint(0, 100) for _ in range (30)],
"v4": [random.randint(0, 100) for _ in range (30)],
"v5": [random.randint(0, 100) for _ in range (30)],
"v6": [random.randint(0, 100) for _ in range (30)],
"v7": [random.randint(0, 100) for _ in range (30)],
"v8": [random.randint(0, 100) for _ in range (30)]})
fa_res = factanal(pdf, factors=4, scores='regression', rotation='promax',
verbose=True, return_dict=True)
Uniquenesses:
v1 v2 v3 v4 v5 v6 v7 v8
0.861 0.005 0.666 0.005 0.611 0.223 0.812 0.885
Loadings:
Factor1 Factor2 Factor3 Factor4
v1 -0.136 0.326
v2 0.983 0.169 0.104
v3 0.128 0.575
v4 0.999
v5 -0.114 0.199 -0.553
v6 -0.204 -0.825 0.197
v7 -0.264 0.317
v8 0.313 0.106
Factor1 Factor2 Factor3 Factor4
SS loadings 1.127 1.048 0.953 0.807
Proportion Var 0.141 0.131 0.119 0.101
Cumulative Var 0.141 0.272 0.391 0.492
Factor Correlations:
Factor1 Factor2 Factor3 Factor4
Factor1 1.0000 0.0380 -0.0526 0.1918
Factor2 0.0380 1.0000 0.0675 -0.0599
Factor3 -0.0526 0.0675 1.0000 -0.0671
Factor4 0.1918 -0.0599 -0.0671 1.0000
Test of the hypothesis that 4 factors are sufficient.
The chi square statistic is 0.37 on 2 degrees of freedom.
The p-value is 0.833
Installation
pip install factanal
Dependencies
The only dependency is the rpy2 library.
In addition to that, R must be installed on your system and accessible to rpy2.
More information on rpy2: https://rpy2.github.io/doc/latest/html/index.html
Download R here: https://www.r-project.org/
Misc
Factanal for python is MIT licensed.
Metadata
Release files for factanal 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| factanal-0.2.0.tar.gz | 2.8 kB | Without provenance | Details for factanal-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| factanal-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for factanal-0.2.0-py3-none-any.whl |
Total release size: 6.9 kB
Release files / factanal-0.2.0.tar.gz
| Download URL | factanal-0.2.0.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eaa8292980654c3db9839716c67c42b5e4fb97fab971be461810510831953a14
|
|
BLAKE2b-256 checksum How to use checksums |
591a0ac64022091e25479f53b5d671b3e6cd9624a069fc2cd71ac4e65d29d110
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
|
Release files / factanal-0.2.0-py3-none-any.whl
| Download URL | factanal-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
442e282dddfcf431e9370eca030c79dba468c976ec8e0079002a0e6b9670b6c5
|
|
BLAKE2b-256 checksum How to use checksums |
e93ab96b31d7668edf8e78334443a1fa68b53c04aa133dab853b1a037942f302
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
|
Security for factanal 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.