# LinRegR2 (PEL)

This function calculates the linear regression of the values defined by a scope expression, and returns the coefficient of determination, R2.

```
LinRegR2(
Scope_Expression,
Numeric_Expression_y
[ , Numeric_Expression_x ]
)
```

#### Parameters

- Scope_Expression

A valid PerformancePoint Expression Language (PEL) expression that returns a scope.

- Numeric_Expression_y

A valid numeric expression that is typically a PEL expression of cell coordinates that return a number that represents values for the y-axis.

- Numeric_Expression_x

A valid numeric expression that is typically a PEL expression of cell coordinates that return a number that represents values for the x-axis.

## Return Value

After obtaining the set of points, the **LinRegR2** function returns the statistical R2 that describes the fit of the linear equation to the points.

## Remarks

Linear regression uses the least-squares method to calculate the equation of a regression line (which means the best-fit line for a series of points). The regression line has the following equation, where a is the slope and b is the intercept:

`y = ax + b`

The **LinRegR2** function evaluates the specified scope against *Numeric_Expression_y* to obtain the values for the y-axis. The function then evaluates the specified scope against *Numeric_Expression_x,* if it is specified, to obtain the values for the x-axis.

If the second numeric expression is not specified, the function uses the current context of the cells in the specified scope as the values for the x-axis. This technique is useful with the Time dimension.

The PEL compiler cannot generate SQL code for this function.