Home

LinregressResult

LinregressResult is the return type of the SciPy function scipy.stats.linregress. It is a namedtuple-like object that encapsulates the results of a simple linear regression of a dependent variable y on an independent variable x using ordinary least squares.

The LinregressResult contains several fields: slope (the regression slope), intercept (the regression intercept), rvalue (the Pearson

Access to the values can be done via attribute lookup, for example result.slope or result.intercept. The results

Implementation-wise, LinregressResult is immutable and serves as a concise container for the common statistics produced by

See also: SciPy, linregress, Pearson correlation.

correlation
coefficient
between
x
and
y),
pvalue
(the
two-tailed
p-value
for
the
null
hypothesis
that
the
slope
is
zero),
and
stderr
(the
standard
error
of
the
estimate,
i.e.,
the
standard
deviation
of
the
residuals).
The
coefficient
of
determination,
r-squared,
can
be
obtained
as
rvalue**2.
can
also
be
retrieved
by
unpacking,
as
in
slope,
intercept,
rvalue,
pvalue,
stderr
=
scipy.stats.linregress(x,
y).
The
function
expects
1-D
numeric
sequences
for
x
and
y
and
returns
a
LinregressResult
with
the
corresponding
statistics
for
the
fitted
line.
a
linear
regression,
enabling
convenient
programmatic
access
without
exposing
more
detailed
regression
diagnostics.