Hoggorm is a Python package for explorative multivariate statistics in Python. It contains

  • PCA (principal component analysis)
  • PCR (principal component regression)
  • PLSR (partial least squares regression)
    • PLSR1 for single variable responses
    • PLSR2 for multivariate responses
  • matrix corrlation coefficients RV and RV2.

Unlike scikit-learn, whis is an excellent Python machine learning package focusing on classification and predicition, Hoggorm rather aims at understanding and interpretation of the variance in the data. Hoggorm also contains tools for prediction.


Make sure that Python 3.5 or higher is installed. A convenient way to install Python and many useful packages for scientific computing is to use the Anaconda distribution.

  • numpy

Installation and updates


Install Hoggorm easily from the command line from the PyPI - the Python Packaging Index.

pip install hoggorm


To upgrade Hoggorm from a previously installed older version execute the following from the command line:

pip install --upgrade hoggorm

If you need more information on how to install Python packages using pip, please see the pip documentation.


  • Documentation at Read the Docs
  • Jupyter notebooks with examples of how to use Hoggorm
    • for PCA
    • for PCR (coming soon)
    • for PLSR1 (coming soon)
    • for PLSR2 (coming soon)
    • for matrix correlation ceoefficitents RV and RV2 (coming soon)


import hoggorm as ho

# Compute PCA model with
# - 5 components
# - standardised/scaled variables
# - KFold cross validation with 4 folds
model = ho.nipalsPCA(arrX=myData, numComp=5, Xstand=True, cvType=["Kfold", 4])

# Extract results from PCA model
scores = model.X_scores()
loadings = model.X_loadings()
cumulativeCalibratedExplainedVariance_allVariables = model.X_cumCalExplVar_indVar()
cumulativeValidatedExplainedVariance_total = model.X_cumValExplVar()