content/flux/v0/stdlib/contrib/anaisdg/statsmodels/linearregression.md
statsmodels.linearRegression() performs a linear regression.
It calculates and returns ŷ (y_hat),
and residual sum of errors (rse).
Output data includes the following columns:
(r.y - r.y_hat) ^ 2 in this context(
<-tables: stream[A],
) => stream[{
B with
y_hat: float,
y: float,
x: float,
sy: H,
sxy: G,
sxx: F,
sx: E,
slope: D,
errors: float,
N: C,
}] where A: Record, D: Divisible + Subtractable
{{% caption %}} For more information, see Function type signatures. {{% /caption %}}
Input data. Default is piped-forward data (<-).
import "contrib/anaisdg/statsmodels"
import "sampledata"
sampledata.float()
|> statsmodels.linearRegression()