Skip to main content

Fast Generalized Linear Mixed Models in Python

Project description

fastglmm

fastglmm is a fast implementation of a Generalized Linear Mixed Model (GLMM) for count/binomial data with variance components.
It is inspired by PQLseq (Sun et al. 2019; PMID: 30020412), with added flexibility and significant performance improvements.

✨ Features

  • Supports Binomial family with logit link
  • Order-of-magnitude faster than PQLseq
  • Handles variance components (tau1, tau2) with options:
    • Fixed values
    • Inference from data
  • Stable Newton-Raphson updates with adaptive step size
  • Regularization for numerical stability
  • Easy to use API similar to statsmodels

📦 Installation

You can easily install fastGLMM via Conda:

conda install -c conda-forge fastglmm

🚀 Usage

import numpy as np
from fastglmm import GLMM

# Simulated data
n = 100
np.random.seed(0)
X = np.hstack((np.ones((n, 1)), np.random.randn(n, 2)))
Y = np.hstack((np.random.randint(0, 10, (n, 1)), np.random.randint(1, 10, (n, 1))))
G = np.random.randn(n, 500)
K = G @ G.T

# Fit model
res = GLMM(X, Y, K).fit()

# Summary
param, coef = res.summary()
print(param)
print(coef)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastglmm-0.1.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

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

fastglmm-0.1.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file fastglmm-0.1.0.tar.gz.

File metadata

  • Download URL: fastglmm-0.1.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for fastglmm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 11cc647bc51b55c8d6925af30244c817686b8c54b1ad4ab64e28b5793048cdce
MD5 289f96832d65b8c9015fd60ebeb57aef
BLAKE2b-256 63953a218f574d75a40d036753b6c8701c9aab9f5f3909abac2adab1e49cae8f

See more details on using hashes here.

File details

Details for the file fastglmm-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fastglmm-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for fastglmm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d2e8ba52ae530a76756c441461a818aaa8ffb17d56ea27b1fc32933e9ff41240
MD5 39092e0b2b774f915914f68cd0636625
BLAKE2b-256 83a396ae8a6eba65513bbaa0eef8d7b6388424f762dcb86f2cea9ecc2c3c9274

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 Pingdom Monitoring Sentry Error logging StatusPage Status page