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
from R.wrapper import factanal
df = pd.DataFrame({"v1": [1,1,1,1,1,1,1,1,1,1,3,3,3,3,3,4,5,6],
"v2": [1,2,1,1,1,1,2,1,2,1,3,4,3,3,3,4,6,5],
"v3": [3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,5,4,6],
"v4": [3,3,4,3,3,1,1,2,1,1,1,1,2,1,1,5,6,4],
"v5": [1,1,1,1,1,3,3,3,3,22,1,1,1,322,1,6,4,5],
"v6": [1,1,2,1,1,3,3,3,3,22,1,1,1,322,1,6,4,5],
"v7": [1,1,4,1,1,3,3,3,3,3,1,2,1,1,1,6,4,5],
"v8": [1,1,5,2,1,3,3,3,4,3,1,2,1,2,1,6,5,4]})
fa_res = factanal(pdf, factors=5, scores='regression', rotation='varimax',
verbose=True, return_dict=True)
pd.DataFrame(fa_res["scores"])
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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file factanal-0.1.6.tar.gz.
File metadata
- Download URL: factanal-0.1.6.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd91ac6d6f68f3b4ac7586d9739fc506f136e3ac4fe075f108a4e2d615f8caf5
|
|
| MD5 |
c2854456f1cddf33652dd50db78408d9
|
|
| BLAKE2b-256 |
e2c636a060eb7fb726fdf7274a12b363113d8166aeeac84ed6c7dcb65b405b97
|
File details
Details for the file factanal-0.1.6-py3-none-any.whl.
File metadata
- Download URL: factanal-0.1.6-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29e5b757f12dd8a76d73894d6712a7c634679da00590b6be7a33310c698b6488
|
|
| MD5 |
30f203c716a05e02136d655b45c644c6
|
|
| BLAKE2b-256 |
6ba7e559b089888f55e70c984c2bfce80baa7812a02a6ba60ab80b96800ba87f
|