lme-python
Python bindings for lme-rs:
linear, generalized linear, and nonlinear mixed-effects models with
lme4-style formulas. Fitting runs in the same Rust engine used by the crate.
Python guide · Examples · Workflow scope
Install
python -m pip install lme-python
Install lme-python, import lme_python. Polars is a package dependency.
A compatible binary wheel does not require a Rust toolchain or an R installation.
Check the selected version's PyPI files for your Python interpreter, OS, and architecture. The release workflow builds CPython 3.10 wheels; source-build CI tests Python 3.10–3.13. Those tests do not imply that a wheel is published for each tested interpreter. If pip falls back to a source build, follow the source setup.
Quick start
This example needs no repository files:
import lme_python
import polars as pl
data = pl.DataFrame(
{
"y": [10.0, 12.0, 13.0, 15.0, 9.0, 11.0, 14.0, 17.0, 8.0, 10.0, 12.0, 14.0],
"x": [0.0, 1.0, 2.0, 3.0] * 3,
"group": ["a"] * 4 + ["b"] * 4 + ["c"] * 4,
}
)
fit = lme_python.lmer("y ~ x + (1 | group)", data=data, reml=True)
print(fit.summary())
print(fit.predict(data))
The formula estimates a shared intercept and slope plus a random intercept
for each group. The small synthetic dataset is an API demonstration.
predict returns fixed-effects predictions; use predict_conditional
when you want the fitted group effects.
Continue your analysis
The bindings expose lm, lmer, glmer, and nlmer, along with prediction,
intervals, simulation, grouped cross-validation, bootstrap refits, ANOVA,
contrasts, and LMM estimated marginal means.
- Python guide: data requirements, fitting, inference, and structured results.
- Type reference: function signatures and result fields.
- Supported workflows: model-specific scope and limitations.
- Troubleshooting: installation, data, convergence, and prediction problems.
- Changelog: release history. Use the matching repository tag for version-specific docs.
Development
See Contributing
for the locked development environment and extension build. After building,
use uv run --no-sync for examples and tests.
task consumer:smoke builds a wheel, verifies it in isolated environments,
and runs portable examples against the installed artifact.
Repeated responses and fit diagnostics
Prepare once when fitting several response vectors against the same design:
prepared = lme_python.prepare_lmer("Reaction ~ Days + (Days | Subject)", data)
control = lme_python.FitControl(max_iterations=2000, require_convergence=True)
fit = prepared.fit(y=data["Reaction"].to_list(), reml=True, control=control)
print(fit.diagnostics)
prepare_lmer(..., weights=...) retains observation precision weights. Responses
must contain finite values and match the original row count. Offsets are applied
exactly once. prepare_glmer also supports prepared.fit(y=..., control=...).
The existing fit_prepared(..., y=..., control=...) and fit_prepared_glmer functions
remain available.
FitControl accepts max_iterations, tolerance, max_inner_iterations, starting
covariance parameters start, and require_convergence. The iteration limit is
per outer search stage. Nonlinear fits use max_inner and max_outer_iters instead.
Inspect converged and diagnostics before interpreting a fit; diagnostics report
termination, iteration counts, objective value, and requested/effective quadrature.
Conversion serializes columns needed by an explicit formula. Dot formulas retain all columns for expansion. Native fitting releases the interpreter lock; custom Python nonlinear mean callbacks reacquire it while evaluating Python code. Bootstrap generates each response as its worker needs it, retaining only replicate summaries. Thread counts no longer change BLAS/OpenMP process settings. License-File: THIRD_PARTY_NOTICES.md License-File: RELINKING.md License-File: Apache-2.0.txt License-File: BSD-3-Clause-OpenBLAS.txt License-File: GPL-2.0-or-later.txt License-File: LGPL-2.1-only.txt License-File: Intel-Simplified-Software-License.txt
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
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 lme_python-0.2.3.tar.gz.
File metadata
- Download URL: lme_python-0.2.3.tar.gz
- Upload date:
- Size: 3.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3a4b5887ba54c8b260de9d352c4c2084ad665f4fb84fcd80635129f901068f1
|
|
| MD5 |
97198485b6e9b5fc8db539572f138f5f
|
|
| BLAKE2b-256 |
179c320e34c5f13a819e9c68105e768a7bdf3f72b69387c6dc53877f698d0af5
|
Provenance
The following attestation bundles were made for lme_python-0.2.3.tar.gz:
Publisher:
python-release.yml on x4g4p3x/lme-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lme_python-0.2.3.tar.gz -
Subject digest:
c3a4b5887ba54c8b260de9d352c4c2084ad665f4fb84fcd80635129f901068f1 - Sigstore transparency entry: 2773753236
- Sigstore integration time:
-
Permalink:
x4g4p3x/lme-rs@4b9d52a8b3d29df811135e1486475a68db5d49f7 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/x4g4p3x
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@4b9d52a8b3d29df811135e1486475a68db5d49f7 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file lme_python-0.2.3-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: lme_python-0.2.3-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 21.4 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed0fe08b71f6a3ac553d0d2aa718e7927e3147d954197d4865342ae34b3ec0d2
|
|
| MD5 |
fa8a3920d0a2e220c2b6f0f77bd1b584
|
|
| BLAKE2b-256 |
333393870e5316513fd96f1f294943489f4c1b22bf89b1b09bc5e26e2c3c55ff
|
Provenance
The following attestation bundles were made for lme_python-0.2.3-cp310-cp310-win_amd64.whl:
Publisher:
python-release.yml on x4g4p3x/lme-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lme_python-0.2.3-cp310-cp310-win_amd64.whl -
Subject digest:
ed0fe08b71f6a3ac553d0d2aa718e7927e3147d954197d4865342ae34b3ec0d2 - Sigstore transparency entry: 2773753445
- Sigstore integration time:
-
Permalink:
x4g4p3x/lme-rs@4b9d52a8b3d29df811135e1486475a68db5d49f7 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/x4g4p3x
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@4b9d52a8b3d29df811135e1486475a68db5d49f7 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file lme_python-0.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: lme_python-0.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 10.0 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08b4db0b3b13b523865785a2a6e05544bf7dbbe2009a9f47d71c8e9d04505805
|
|
| MD5 |
73c48d6ca87aa57fc26dd39878840acb
|
|
| BLAKE2b-256 |
9df8aa5477c413e1778ebf8183801cd057c15c43bc4bf75ba8c6ed6116d11d00
|
Provenance
The following attestation bundles were made for lme_python-0.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
python-release.yml on x4g4p3x/lme-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lme_python-0.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
08b4db0b3b13b523865785a2a6e05544bf7dbbe2009a9f47d71c8e9d04505805 - Sigstore transparency entry: 2773753403
- Sigstore integration time:
-
Permalink:
x4g4p3x/lme-rs@4b9d52a8b3d29df811135e1486475a68db5d49f7 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/x4g4p3x
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@4b9d52a8b3d29df811135e1486475a68db5d49f7 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file lme_python-0.2.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: lme_python-0.2.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 6.3 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bd8e2e669440955f2fdb31b35dacce721f7de138621e278d3e8c85ad6635ff2
|
|
| MD5 |
d07f432fb2619656fbaa16418fbfa98e
|
|
| BLAKE2b-256 |
872c78660e981286adcd3b4615713b05cdf9eb5ce38b89b7e6ad42e00040af73
|
Provenance
The following attestation bundles were made for lme_python-0.2.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
python-release.yml on x4g4p3x/lme-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lme_python-0.2.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
1bd8e2e669440955f2fdb31b35dacce721f7de138621e278d3e8c85ad6635ff2 - Sigstore transparency entry: 2773753333
- Sigstore integration time:
-
Permalink:
x4g4p3x/lme-rs@4b9d52a8b3d29df811135e1486475a68db5d49f7 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/x4g4p3x
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@4b9d52a8b3d29df811135e1486475a68db5d49f7 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file lme_python-0.2.3-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: lme_python-0.2.3-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 5.3 MB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d54639c2b1a7152c7d118b1949aa7f52074150807ecf030c55eeb31f07f9d20a
|
|
| MD5 |
a7956a570f6d10caf9d54d9b85054993
|
|
| BLAKE2b-256 |
956088d86720b6106808223d487c63be85e317d9b52021a5b0e9159bf08deb80
|
Provenance
The following attestation bundles were made for lme_python-0.2.3-cp310-cp310-macosx_11_0_arm64.whl:
Publisher:
python-release.yml on x4g4p3x/lme-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lme_python-0.2.3-cp310-cp310-macosx_11_0_arm64.whl -
Subject digest:
d54639c2b1a7152c7d118b1949aa7f52074150807ecf030c55eeb31f07f9d20a - Sigstore transparency entry: 2773753291
- Sigstore integration time:
-
Permalink:
x4g4p3x/lme-rs@4b9d52a8b3d29df811135e1486475a68db5d49f7 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/x4g4p3x
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@4b9d52a8b3d29df811135e1486475a68db5d49f7 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file lme_python-0.2.3-cp310-cp310-macosx_10_12_x86_64.whl.
File metadata
- Download URL: lme_python-0.2.3-cp310-cp310-macosx_10_12_x86_64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.10, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afc059fdd9eebfffaf14820e3f2085f20ce9f82192960d84aa79befd2c70a353
|
|
| MD5 |
a14845dbe08cce4d163cae6b31a2de93
|
|
| BLAKE2b-256 |
f6de4e1c40a0d79232ee3d9ccb4ccab8423972c6b12be42fb6dbb8b834272aff
|
Provenance
The following attestation bundles were made for lme_python-0.2.3-cp310-cp310-macosx_10_12_x86_64.whl:
Publisher:
python-release.yml on x4g4p3x/lme-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lme_python-0.2.3-cp310-cp310-macosx_10_12_x86_64.whl -
Subject digest:
afc059fdd9eebfffaf14820e3f2085f20ce9f82192960d84aa79befd2c70a353 - Sigstore transparency entry: 2773753379
- Sigstore integration time:
-
Permalink:
x4g4p3x/lme-rs@4b9d52a8b3d29df811135e1486475a68db5d49f7 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/x4g4p3x
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@4b9d52a8b3d29df811135e1486475a68db5d49f7 -
Trigger Event:
workflow_dispatch
-
Statement type: