LinRegPoint (PQL)
Calculates the linear regression of a set, and returns the value of the y-intercept in the regression line, y = ax + b for a particular value of x
- Returned Output: Numeric
- Library: PQL \ Semantic \ Statistical
- Version: 2023.00.000
- Compatibility: Pyramid Query Language (PQL) data sources
Syntax
* Click on the function's arguments above for more details on the input values.
Comments
The LinRegX functions calculate the linear regression for the supplied values / measures, and then return one of the values associated with that regression. The linear regression functions are:
- LinRegIntercept (PQL) - Returns the value of b, the y-intercept.
- LinRegPoint (PQL) - Returns the y-value for the regression line at a particular value of x.
- LinRegR2 (PQL) - Returns the coefficient of determination, R2.
- LinRegSlope (PQL) - Returns the value of a, the slope.
Arguments
LinRegPoint returns the y-value for a particular value of x for the linear regression. It requires the following arguments:
- The first Numeric parameter provides the value of x.
- The value can be returned from a hierarchy as a numeric expression.
- The List parameter is a list or set of elements from an existing hierarchy in the model.
- The hierarchy name needs to be a Unique Name with the format
[dimension].^[hierarchy]
or[table].[column]
. - The Numeric parameters following the set are each evaluated against the specified set to obtain the values for the y- and x-axes, respectively.
- The values can be returned from a hierarchy as a numeric expression.
- If the optional numeric value is not supplied, the current context of the cells is used for the x-axis.
Remarks
- For details on how to employ and use this function see the semantic calculation overview.
Different Function types
This function is like the MDX LinRegPoint function, returning the value of y in the regression line, y = ax + b.
Examples
The following example returns the predicted value of Fact Sales over the past ten periods based on the statistical relationship between Fact Sales and Profits.
LinRegPoint( [Measures].[Fact Sales], Tail([Date].[dateKey].allmembers, 10), [Measures].[Fact Sales], [Measures].[Profit] )
Tip: Alternatively, use Last in place of Tail. Last and Tail are aliases for the function that retrieves the last X elements in a given hierarchy. For more information, see Tail (PQL).