MLingreg (Multiple Linear Regression) Function

Table 135. MLingreg (Multiple Linear Regression) Function 

Field

Description

Description

Returns a predicted value for a column expression based on a least squares multiple linear regression of the previous width-1 based on the sort_expression column values. When there are fewer than width-1 preceding rows, the MLinreg function computes the regression using all the preceding rows.

Syntax:

MLingreg(value_expression, width, sort_expression_list)

value_expression

The value expression represents a scalar numeric column expression for which a moving average is to be computed. The expression cannot contain any OLAP or aggregate functions.

width

The width represents the number of previous rows to be used in computing the moving average. The width-1 previous rows are used to compute the linear regression and the row value itself is used to calculate the predicted value. The width value is always a positive integer constant greater than 1. The maximum width is 4096.

sort_expression_list

The sort_expression_list is a column reference used to sort the values and to define the dependent variable for calculating the linear regression. The sort_expression_list is an expression with optional sort direction specification. The default sort direction is ascending (ASC). Only one sort_expression is allowed with this function.