Skip to main content

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

factanal-0.1.7.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

factanal-0.1.7-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file factanal-0.1.7.tar.gz.

File metadata

  • Download URL: factanal-0.1.7.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

Hashes for factanal-0.1.7.tar.gz
Algorithm Hash digest
SHA256 e1cb6a16709ee721501e3d528e6e754a348c672fcc6a6093ae567118d3315cda
MD5 f255d213d6f9f0a5e5a697f10ac3186c
BLAKE2b-256 0f3b2d78606ef83a1cbe283df4523b89af4c685a9ad5cba941a842cebef620da

See more details on using hashes here.

File details

Details for the file factanal-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: factanal-0.1.7-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

Hashes for factanal-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 f6296bc00cafb4376f03bc7737ecf49dc31e6dc1ee9136ac1137d8b710b1e26d
MD5 f4968d08aec779c300416861875fbc2f
BLAKE2b-256 638373f0877d7743f8e365cb12515e54216ea431cb843dff6ce416c350f545aa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page