LINEST

適用於:匯出數據行匯出數據表量值視覺計算

使用最小平方方法來計算最符合指定資料的直線,然後傳回描述該線條的資料表。 線條的方程式的格式如下:y = Slope1*x1+ Slope2*x2+ ... + Intercept

語法

LINEST ( <columnY>, <columnX>[, …][, <const>] )

參數

詞彙 定義
columnY 已知 y 值的資料行。 必須具有純量類型。
columnX 已知 x 值的資料行。 必須具有純量類型。 至少必須指定一個。
const (選用) 常數 TRUE/FALSE 值,指定是否強制常數 Intercept 等於 0。
如果為 TRUE 或省略,則會正常計算 Intercept 值;如果為 FALSE,則 Intercept 值會設定為零。

傳回值

描述這一行的單一資料列資料表,加上其他統計資料。 以下是可用的資料行:

  • Slope1Slope2、...、SlopeN:對應至每個 x 值的係數;
  • 攔截:攔截值;
  • StandardErrorSlope1StandardErrorSlope2、...、StandardErrorSlopeN :係數 Slope1Slope2、...、SlopeN 的標準誤差值;
  • StandardErrorIntercept:常數 Intercept的標準錯誤值;
  • CoefficientOfDetermination:判斷係數 (r超值)。 比較估計值和實際 y 值,以及從 0 到 1 的值範圍:值越高,樣本中的相互關聯就越高;
  • StandardError:y 估計的標準錯誤;
  • FStatistic:F 統計資料或 F 觀察的值。 使用 F 統計資料來判斷相依變數與獨立變數之間的觀察關聯性是否偶然發生;
  • DegreesOfFreedom:自由度。 使用此值可協助您在統計資料表中尋找 F 索引碼,並判斷模型的信賴等級;
  • RegressionSumOfSquares:平方的回歸總和;
  • ResidualSumOfSquares:平方的剩餘總和。

備註

<columnY> 和 <columnX> 的傳回值必須全部屬於相同的資料表。

範例 1

下列 DAX 查詢:

EVALUATE LINEST(
	'FactInternetSales'[SalesAmount],
	'FactInternetSales'[TotalProductCost]
)

傳回具有十個數據行的單一資料列資料表:

Slope1 攔截 StandardErrorSlope1 StandardErrorIntercept CoefficientOfDetermination
1.67703250456677 6.34550460373026 0.000448675725548806 0.279131821917317 0.995695557281456
StandardError FStatistic DegreesOfFreedom RegressionSumOfSquares ResidualSumOfSquares
60.9171030357485 13970688.6139993 60396 51843736761.658 224123120.339218
  • Slope1Intercept:計算線性模型的係數;
  • StandardErrorSlope1StandardErrorIntercept:上述係數的標準誤差值;
  • CoefficientOfDeterminationStandardErrorFStatisticDegreesOfFreedomRegressionSumOfSquares ResidualSumOfSquares:模型的回歸統計資料。

針對指定的網際網路銷售,此模型會透過下列公式預測銷售金額:

SalesAmount = Slope1 * TotalProductCost + Intercept

範例 2

下列 DAX 查詢:

EVALUATE LINEST(
	'DimCustomer'[TotalSalesAmount],
	'DimCustomer'[YearlyIncome],
	'DimCustomer'[TotalChildren],
	'DimCustomer'[BirthDate]
)

傳回具有十四個數據行的單一資料列資料表:

  • Slope1
  • Slope2
  • Slope3
  • 攔截
  • StandardErrorSlope1
  • StandardErrorSlope2
  • StandardErrorSlope3
  • StandardErrorIntercept
  • CoefficientOfDetermination
  • StandardError
  • FStatistic
  • DegreesOfFreedom
  • RegressionSumOfSquares
  • ResidualSumOfSquares

針對指定的客戶,此模型會根據下列公式預測總銷售額 (出生日期會自動轉換成數字):

TotalSalesAmount = Slope1 * YearlyIncome + Slope2 * TotalChildren + Slope3 * BirthDate + Intercept

LINESTX
統計函式