Newer Version Available

This content describes an older version of this product. View Latest

regr_r2()

Uses two numerical fields to calculate R-squared, or goodness of fit. Use regr_r2() to understand how well the trend line fits your data.

field_y is a grouped dependent numeric expression and field_x is a grouped independent numeric expression. regr_r2(field_y, field_x) uses simple linear regression to calculate a trend line, then calculates R-squared. If the returned value is small, then functions like regr_slope() and regr_intercept() are likely to return accurate results.

The input fields (field_y, field_x) must contain at least two pairs of non-null values. This function works with simple grouped values but not with cogroups.

Example - How Well Does the Calculated Trend Line Fit My Data

Suppose that you have a dataset that includes the number of activities (such as meetings) and the won opportunity amount.

Sample scatter plot.

You want to check the calculated trend line for 'goodness of fit' to see how accurate the results from other statistical functions are.

The value of R squared is 0.95.

Diagram showing R squared result.