OpenBI Docs Buy

LINEST

A least-squares line through columns of the model, in one row: slopes, intercept, their standard errors and the fit's statistics.

Group: Statistics. Compatible with DAX.

Syntax

LINEST ( <columnY>, <columnX> [, <columnX>] … [, <const>] )
ParameterTypeDescription
columnYColumnThe column whose values the line explains.
columnXColumn
repeatable
A column that explains them, of the same table; one or more.
constBoolean
optional
TRUE or left out to fit an intercept; FALSE for a line through the origin. Written as TRUE or FALSE, last.

Returns

Table. One row: Slope1 … SlopeN, Intercept, StandardErrorSlope1 … StandardErrorSlopeN, StandardErrorIntercept, CoefficientOfDetermination, StandardError, FStatistic, DegreesOfFreedom, RegressionSumOfSquares and ResidualSumOfSquares.

Remarks

  • The rows are those of the columns' table that the current filters leave. A blank y or x counts as 0: a row drops out only when all its values, y and every x, are blank.
  • All the columns must come from one table. For a column of a related table, or any other expression, use LINESTX with RELATED.
  • A prediction is Intercept + Slope1 × x1 + Slope2 × x2 …; the slopes and their standard errors are those R's lm reports.
  • An x column that follows from the others, such as one twice another or a constant, gets a slope of 0 and a standard error of 0, and the others share the fit.
  • With const FALSE there is no Intercept column, nor its standard error.
  • No more rows than coefficients is an error: one x with an intercept needs three rows at least.

Examples

Driving minutes against meters

Over every pair of places: what each extra kilometer costs, and what a trip costs before it starts.

EVALUATE
SELECTCOLUMNS (
    LINEST ( Distances[Minutes], Distances[Meters] ),
    "Minutes per km", [Slope1] * 1000,
    "Minutes to start", [Intercept],
    "R squared", [CoefficientOfDetermination]
)
Minutes per kmMinutes to startR squared
0.8248225345552276.374876144314970.468833646514482

The whole row, in the current filters

Only the trips that start at the depot.

EVALUATE
CALCULATETABLE (
    LINEST ( Distances[Minutes], Distances[Meters] ),
    Distances[From] = "Depot Alnabru"
)
Slope1InterceptStandardErrorSlope1StandardErrorInterceptCoefficientOfDeterminationStandardErrorFStatisticDegreesOfFreedomRegressionSumOfSquaresResidualSumOfSquares
0.0006368785694223386.434570733077430.0001856875629262921.8309647420550.4750401829490632.215940740553711.76380015718161357.764886246606163.8351137533938

LINESTX, TRENDLINE, CORREL, T.DIST.2T.

Last updated · OpenBI Studio 0.3.74