Skip to content

Commit d18d085

Browse files
committed
rename xdata -> xhat in viz._estimate_from_line
1 parent 3a3b401 commit d18d085

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

probscale/viz.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -531,13 +531,13 @@ def _fit_ci(x, y, xhat, fitlogs=None, niter=10000, alpha=0.05):
531531
return yhat_lo, yhat_hi
532532

533533

534-
def _estimate_from_fit(xdata, slope, intercept, xlog=False, ylog=False):
534+
def _estimate_from_fit(xhat, slope, intercept, xlog=False, ylog=False):
535535
""" Estimate the dependent variables of a linear fit given x-data
536536
and linear parameters.
537537
538538
Parameters
539539
----------
540-
xdata : numpy array or pandas Series/DataFrame
540+
xhat : numpy array or pandas Series/DataFrame
541541
The input independent variable of the fit
542542
slope : float
543543
Slope of the best-fit line
@@ -549,23 +549,23 @@ def _estimate_from_fit(xdata, slope, intercept, xlog=False, ylog=False):
549549
550550
Returns
551551
-------
552-
yhat : same type as xdata
552+
yhat : numpy array
553553
Estimate of the dependent variable.
554554
555555
"""
556556

557-
x = numpy.array(xdata)
557+
xhat = numpy.asarray(xhat)
558558
if ylog:
559559
if xlog:
560-
yhat = numpy.exp(intercept) * x ** slope
560+
yhat = numpy.exp(intercept) * xhat ** slope
561561
else:
562-
yhat = numpy.exp(intercept) * numpy.exp(slope) ** x
562+
yhat = numpy.exp(intercept) * numpy.exp(slope) ** xhat
563563

564564
else:
565565
if xlog:
566-
yhat = slope * numpy.log(x) + intercept
566+
yhat = slope * numpy.log(xhat) + intercept
567567

568568
else:
569-
yhat = slope * x + intercept
569+
yhat = slope * xhat + intercept
570570

571571
return yhat

0 commit comments

Comments
 (0)