lme-python 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. lme_python-0.1.1/.github/workflows/ci.yml +66 -0
  2. lme_python-0.1.1/.github/workflows/python-release.yml +137 -0
  3. lme_python-0.1.1/.gitignore +14 -0
  4. lme_python-0.1.1/CHANGELOG.md +21 -0
  5. lme_python-0.1.1/Cargo.lock +4392 -0
  6. lme_python-0.1.1/Cargo.toml +46 -0
  7. lme_python-0.1.1/GUIDE.md +490 -0
  8. lme_python-0.1.1/LICENSE +21 -0
  9. lme_python-0.1.1/PKG-INFO +9 -0
  10. lme_python-0.1.1/README.md +101 -0
  11. lme_python-0.1.1/benches/bench_math.rs +240 -0
  12. lme_python-0.1.1/examples/COMPARISONS.md +910 -0
  13. lme_python-0.1.1/examples/comparison_chart.png +0 -0
  14. lme_python-0.1.1/examples/glmm_cbpp.R +32 -0
  15. lme_python-0.1.1/examples/glmm_cbpp.jl +59 -0
  16. lme_python-0.1.1/examples/glmm_cbpp.py +45 -0
  17. lme_python-0.1.1/examples/glmm_cbpp.rs +56 -0
  18. lme_python-0.1.1/examples/glmm_grouseticks.R +27 -0
  19. lme_python-0.1.1/examples/glmm_grouseticks.jl +66 -0
  20. lme_python-0.1.1/examples/glmm_grouseticks.py +48 -0
  21. lme_python-0.1.1/examples/glmm_grouseticks.rs +59 -0
  22. lme_python-0.1.1/examples/lmm_dyestuff.R +13 -0
  23. lme_python-0.1.1/examples/lmm_dyestuff.jl +23 -0
  24. lme_python-0.1.1/examples/lmm_dyestuff.py +21 -0
  25. lme_python-0.1.1/examples/lmm_dyestuff.rs +25 -0
  26. lme_python-0.1.1/examples/lmm_pastes.R +27 -0
  27. lme_python-0.1.1/examples/lmm_pastes.jl +48 -0
  28. lme_python-0.1.1/examples/lmm_pastes.py +35 -0
  29. lme_python-0.1.1/examples/lmm_pastes.rs +44 -0
  30. lme_python-0.1.1/examples/lmm_penicillin.R +28 -0
  31. lme_python-0.1.1/examples/lmm_penicillin.jl +53 -0
  32. lme_python-0.1.1/examples/lmm_penicillin.py +35 -0
  33. lme_python-0.1.1/examples/lmm_penicillin.rs +44 -0
  34. lme_python-0.1.1/examples/sleepstudy.R +26 -0
  35. lme_python-0.1.1/examples/sleepstudy.jl +61 -0
  36. lme_python-0.1.1/examples/sleepstudy.py +64 -0
  37. lme_python-0.1.1/examples/sleepstudy.rs +56 -0
  38. lme_python-0.1.1/examples/sleepstudy_ml.R +25 -0
  39. lme_python-0.1.1/examples/sleepstudy_ml.jl +16 -0
  40. lme_python-0.1.1/examples/sleepstudy_ml.py +25 -0
  41. lme_python-0.1.1/examples/sleepstudy_ml.rs +53 -0
  42. lme_python-0.1.1/pyproject.toml +21 -0
  43. lme_python-0.1.1/python/Cargo.lock +4180 -0
  44. lme_python-0.1.1/python/Cargo.toml +15 -0
  45. lme_python-0.1.1/python/PYTHON_GUIDE.md +288 -0
  46. lme_python-0.1.1/python/src/lib.rs +201 -0
  47. lme_python-0.1.1/python/tests/test_basic.py +27 -0
  48. lme_python-0.1.1/scripts/ast_explorations/test_fiasto.rs +6 -0
  49. lme_python-0.1.1/scripts/ast_explorations/test_fiasto_offset.rs +6 -0
  50. lme_python-0.1.1/scripts/dump_dyestuff.R +3 -0
  51. lme_python-0.1.1/scripts/dump_pastes.R +3 -0
  52. lme_python-0.1.1/scripts/make_penicillin_csv.py +42 -0
  53. lme_python-0.1.1/scripts/plot_comparisons.py +113 -0
  54. lme_python-0.1.1/src/anova.rs +164 -0
  55. lme_python-0.1.1/src/family.rs +987 -0
  56. lme_python-0.1.1/src/formula.rs +351 -0
  57. lme_python-0.1.1/src/glmm_math.rs +558 -0
  58. lme_python-0.1.1/src/kenward_roger.rs +319 -0
  59. lme_python-0.1.1/src/lib.rs +1402 -0
  60. lme_python-0.1.1/src/math.rs +420 -0
  61. lme_python-0.1.1/src/model_matrix.rs +371 -0
  62. lme_python-0.1.1/src/optimizer.rs +293 -0
  63. lme_python-0.1.1/src/robust.rs +124 -0
  64. lme_python-0.1.1/src/satterthwaite.rs +325 -0
  65. lme_python-0.1.1/tests/data/cbpp_binary.csv +843 -0
  66. lme_python-0.1.1/tests/data/dyestuff.csv +31 -0
  67. lme_python-0.1.1/tests/data/glmm_binomial.json +872 -0
  68. lme_python-0.1.1/tests/data/glmm_poisson.json +536 -0
  69. lme_python-0.1.1/tests/data/grouseticks.csv +404 -0
  70. lme_python-0.1.1/tests/data/intercept_only.json +226 -0
  71. lme_python-0.1.1/tests/data/mock_crossed.json +57 -0
  72. lme_python-0.1.1/tests/data/mock_ml.json +234 -0
  73. lme_python-0.1.1/tests/data/pastes.csv +61 -0
  74. lme_python-0.1.1/tests/data/penicillin.csv +145 -0
  75. lme_python-0.1.1/tests/data/penicillin.json +199 -0
  76. lme_python-0.1.1/tests/data/random_slopes.json +244 -0
  77. lme_python-0.1.1/tests/data/sleepstudy.csv +181 -0
  78. lme_python-0.1.1/tests/generate_mock_data.py +50 -0
  79. lme_python-0.1.1/tests/generate_test_data.R +231 -0
  80. lme_python-0.1.1/tests/test_anova.rs +64 -0
  81. lme_python-0.1.1/tests/test_conditional_real.rs +68 -0
  82. lme_python-0.1.1/tests/test_confint_simulate.rs +169 -0
  83. lme_python-0.1.1/tests/test_coverage_edge_cases.rs +44 -0
  84. lme_python-0.1.1/tests/test_coverage_gaps.rs +186 -0
  85. lme_python-0.1.1/tests/test_crossed_mock.rs +107 -0
  86. lme_python-0.1.1/tests/test_e2e_lmer.rs +52 -0
  87. lme_python-0.1.1/tests/test_edge_cases.rs +183 -0
  88. lme_python-0.1.1/tests/test_errors.rs +91 -0
  89. lme_python-0.1.1/tests/test_formula.rs +11 -0
  90. lme_python-0.1.1/tests/test_gaps.rs +310 -0
  91. lme_python-0.1.1/tests/test_glmm.rs +154 -0
  92. lme_python-0.1.1/tests/test_intercept_only.rs +131 -0
  93. lme_python-0.1.1/tests/test_kenward_roger.rs +160 -0
  94. lme_python-0.1.1/tests/test_ml_optimization.rs +94 -0
  95. lme_python-0.1.1/tests/test_no_intercept.rs +65 -0
  96. lme_python-0.1.1/tests/test_numerical_parity.rs +302 -0
  97. lme_python-0.1.1/tests/test_predict.rs +90 -0
  98. lme_python-0.1.1/tests/test_random_slopes.rs +105 -0
  99. lme_python-0.1.1/tests/test_robust.rs +75 -0
  100. lme_python-0.1.1/tests/test_sandwich_math.R +46 -0
  101. lme_python-0.1.1/tests/test_satterthwaite.rs +121 -0
@@ -0,0 +1,66 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+ branches: [master]
8
+
9
+ env:
10
+ CARGO_TERM_COLOR: always
11
+
12
+ jobs:
13
+ test:
14
+ name: Test (${{ matrix.os }})
15
+ runs-on: ${{ matrix.os }}
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ os: [ubuntu-latest, windows-latest, macos-latest]
20
+
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+
24
+ - name: Install Rust toolchain
25
+ uses: dtolnay/rust-toolchain@stable
26
+
27
+ - name: Install OpenBLAS (macOS)
28
+ if: matrix.os == 'macos-latest'
29
+ run: brew install openblas
30
+
31
+ - name: Install OpenBLAS (Ubuntu)
32
+ if: matrix.os == 'ubuntu-latest'
33
+ run: sudo apt-get update && sudo apt-get install -y libopenblas-dev
34
+
35
+ - name: Cache cargo registry & build
36
+ uses: actions/cache@v4
37
+ with:
38
+ path: |
39
+ ~/.cargo/registry
40
+ ~/.cargo/git
41
+ target
42
+ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
43
+ restore-keys: ${{ runner.os }}-cargo-
44
+
45
+ - name: Build
46
+ run: cargo build --verbose
47
+
48
+ - name: Run tests
49
+ run: cargo test --verbose
50
+
51
+ - name: Check formatting
52
+ if: matrix.os == 'ubuntu-latest'
53
+ run: cargo fmt --check
54
+
55
+ - name: Run clippy
56
+ if: matrix.os == 'ubuntu-latest'
57
+ run: cargo clippy -- -D warnings
58
+
59
+ docs:
60
+ name: Build docs
61
+ runs-on: ubuntu-latest
62
+ steps:
63
+ - uses: actions/checkout@v4
64
+ - uses: dtolnay/rust-toolchain@stable
65
+ - name: Build documentation
66
+ run: cargo doc --no-deps --verbose
@@ -0,0 +1,137 @@
1
+ name: Build and Publish Python Wheels
2
+
3
+ # Trigger on pushes to the master branch or when a release tag (v*) is pushed
4
+ on:
5
+ push:
6
+ branches:
7
+ - master
8
+ tags:
9
+ - 'v*'
10
+ pull_request:
11
+ paths:
12
+ - 'python/**'
13
+ - 'src/**'
14
+ workflow_dispatch:
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ linux:
21
+ runs-on: ubuntu-latest
22
+ strategy:
23
+ matrix:
24
+ target: [x86_64, aarch64]
25
+ steps:
26
+ - uses: actions/checkout@v4
27
+ - uses: actions/setup-python@v5
28
+ with:
29
+ python-version: '3.10'
30
+ - name: Build wheels
31
+ uses: PyO3/maturin-action@v1
32
+ with:
33
+ target: ${{ matrix.target }}
34
+ args: --release --out dist --manifest-path python/Cargo.toml -i python3.10
35
+ sccache: 'true'
36
+ manylinux: auto
37
+ before-script-linux: |
38
+ if command -v apt-get >/dev/null 2>&1; then
39
+ apt-get update && apt-get install -y pkg-config libssl-dev
40
+ elif command -v yum >/dev/null 2>&1; then
41
+ yum install -y pkgconfig openssl-devel
42
+ fi
43
+ env:
44
+ CFLAGS: "-std=gnu99"
45
+ CFLAGS_aarch64_unknown_linux_gnu: "-std=gnu99"
46
+ - name: Upload wheels
47
+ uses: actions/upload-artifact@v4
48
+ with:
49
+ name: wheels-linux-${{ matrix.target }}
50
+ path: dist
51
+
52
+ windows:
53
+ runs-on: windows-latest
54
+ strategy:
55
+ matrix:
56
+ target: [x64]
57
+ steps:
58
+ - uses: actions/checkout@v4
59
+ - uses: actions/setup-python@v5
60
+ with:
61
+ python-version: '3.10'
62
+ architecture: ${{ matrix.target }}
63
+ - name: Build wheels
64
+ uses: PyO3/maturin-action@v1
65
+ with:
66
+ target: ${{ matrix.target }}
67
+ args: --release --out dist --manifest-path python/Cargo.toml
68
+ sccache: 'true'
69
+ - name: Upload wheels
70
+ uses: actions/upload-artifact@v4
71
+ with:
72
+ name: wheels-windows-${{ matrix.target }}
73
+ path: dist
74
+
75
+ macos:
76
+ runs-on: macos-latest
77
+ strategy:
78
+ matrix:
79
+ target: [x86_64, aarch64]
80
+ steps:
81
+ - uses: actions/checkout@v4
82
+ - uses: actions/setup-python@v5
83
+ with:
84
+ python-version: '3.10'
85
+ - name: Install OpenBLAS
86
+ run: brew install openblas
87
+ - name: Build wheels
88
+ uses: PyO3/maturin-action@v1
89
+ with:
90
+ target: ${{ matrix.target }}
91
+ args: --release --out dist --manifest-path python/Cargo.toml
92
+ sccache: 'true'
93
+ - name: Upload wheels
94
+ uses: actions/upload-artifact@v4
95
+ with:
96
+ name: wheels-macos-${{ matrix.target }}
97
+ path: dist
98
+
99
+ sdist:
100
+ runs-on: ubuntu-latest
101
+ steps:
102
+ - uses: actions/checkout@v4
103
+ - name: Build sdist
104
+ uses: PyO3/maturin-action@v1
105
+ with:
106
+ command: sdist
107
+ args: --out dist --manifest-path python/Cargo.toml
108
+ - name: Upload sdist
109
+ uses: actions/upload-artifact@v4
110
+ with:
111
+ name: wheels-sdist
112
+ path: dist
113
+
114
+ publish:
115
+ name: Publish to PyPI
116
+ needs: [linux, windows, macos, sdist]
117
+ runs-on: ubuntu-latest
118
+ # Only publish to PyPI on tag pushes (e.g., git tag v0.1.0 && git push origin v0.1.0)
119
+ if: "startsWith(github.ref, 'refs/tags/')"
120
+ environment: pypi
121
+ permissions:
122
+ id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
123
+ contents: write # needed to create GitHub Release
124
+ steps:
125
+ - uses: actions/download-artifact@v4
126
+ with:
127
+ path: dist
128
+ pattern: wheels-*
129
+ merge-multiple: true
130
+
131
+ - name: Publish to PyPI
132
+ uses: pypa/gh-action-pypi-publish@release/v1
133
+
134
+ - name: Upload to GitHub Release
135
+ uses: softprops/action-gh-release@v1
136
+ with:
137
+ files: dist/*
@@ -0,0 +1,14 @@
1
+ /target
2
+ reference/
3
+ rlib/
4
+ julia-portable/
5
+ julia-portable.zip
6
+ flamegraph.svg
7
+
8
+ # Python bindings
9
+ python/target/
10
+ python/.venv/
11
+ __pycache__/
12
+ *.whl
13
+ .pytest_cache/
14
+ *.log
@@ -0,0 +1,21 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] - 2026-03-08
9
+
10
+ ### Added
11
+
12
+ - **Core LMM** — `lmer()` with REML and ML estimation, matching R's `lme4` to 4 decimal places
13
+ - **GLMM** — `glmer()` with Poisson, Binomial, Gaussian, and Gamma families via Laplace approximation
14
+ - **Predictions** — `predict()`, `predict_conditional()`, `predict_response()`, `predict_conditional_response()` with `allow_new_levels` support
15
+ - **Inference** — Satterthwaite and Kenward-Roger degrees of freedom, robust sandwich standard errors
16
+ - **Model comparison** — `anova()` for likelihood ratio tests between nested models
17
+ - **Diagnostics** — `confint()` for Wald confidence intervals, `simulate()` for parametric bootstrap
18
+ - **Formula parser** — Wilkinson notation with nested (`a/b`), crossed (`a + b`), and correlated slope+intercept (`x | group`) random effects
19
+ - **Sparse matrix architecture** — Compressed sparse column format with sparse Cholesky for large datasets
20
+ - **Python bindings** — `lme_python` package via PyO3/maturin with `lmer()`, `glmer()`, `predict()`
21
+ - **Documentation** — `GUIDE.md`, `PYTHON_GUIDE.md`, and cross-language `COMPARISONS.md`