Skip to content

Commit 839603e

Browse files
committed
Fix linear model smoothing with weights
1 parent 6f7488e commit 839603e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

doc/changelog.qmd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ title: Changelog
1010
- Added [](:class:`~plotnine.composition.plot_layout`) with which you can customise the
1111
layout of plots in composition.
1212

13+
### Bug Fixes
14+
15+
- Fixed [](:class:`~plotnine.geom_smooth`) / [](:class:`~plotnine.stat_smooth`) when using a linear model via "lm" with weights for the model to do a weighted regression. This bug did not affect the formula API of the linear model. ({{< issue 1005 >}})
16+
1317
## v0.15.1
1418
(2025-09-30)
1519

plotnine/stats/smoothers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def lm(data, xseq, params) -> pd.DataFrame:
6464

6565
X = sm.add_constant(data["x"])
6666
Xseq = sm.add_constant(xseq)
67-
weights = data.get("weights", None)
67+
weights = data.get("weight", None)
6868

6969
if weights is None:
7070
init_kwargs, fit_kwargs = separate_method_kwargs(

0 commit comments

Comments
 (0)