@@ -319,7 +319,7 @@ def plot_partial(self, smooth_index, plot_se=True, cpr=False,
319
319
If plot_se is true, then the confidence interval for the linear
320
320
prediction will be added to the plot.
321
321
cpr : bool
322
- If cpr (component plus residual) is true, the a scatter plot of
322
+ If cpr (component plus residual) is true, then a scatter plot of
323
323
the partial working residuals will be added to the plot.
324
324
include_constant : bool
325
325
If true, then the estimated intercept is added to the prediction
@@ -332,7 +332,7 @@ def plot_partial(self, smooth_index, plot_se=True, cpr=False,
332
332
Returns
333
333
-------
334
334
Figure
335
- If `ax` is None, the created figure. Otherwise the Figure to which
335
+ If `ax` is None, the created figure. Otherwise, the Figure to which
336
336
`ax` is connected.
337
337
"""
338
338
from statsmodels .graphics .utils import _import_mpl , create_mpl_ax
@@ -349,16 +349,18 @@ def plot_partial(self, smooth_index, plot_se=True, cpr=False,
349
349
se = se [sort_index ]
350
350
351
351
fig , ax = create_mpl_ax (ax )
352
- ax .plot (x , y_est , c = 'blue' , lw = 2 )
353
- if plot_se :
354
- ax .plot (x , y_est + 1.96 * se , '-' , c = 'blue' )
355
- ax .plot (x , y_est - 1.96 * se , '-' , c = 'blue' )
352
+
356
353
if cpr :
357
354
# TODO: resid_response does not make sense with nonlinear link
358
355
# use resid_working ?
359
356
residual = self .resid_working [sort_index ]
360
357
cpr_ = y_est + residual
361
- ax .plot (x , cpr_ , '.' , lw = 2 )
358
+ ax .scatter (x , cpr_ , s = 4 )
359
+
360
+ ax .plot (x , y_est , c = 'blue' , lw = 2 )
361
+ if plot_se :
362
+ ax .plot (x , y_est + 1.96 * se , '-' , c = 'blue' )
363
+ ax .plot (x , y_est - 1.96 * se , '-' , c = 'blue' )
362
364
363
365
ax .set_xlabel (smoother .smoothers [variable ].variable_name )
364
366
0 commit comments