# Basic Linear Regression: Slope, Intercept, and R-squared

**63**

Wondering if there's interest in basic linear regression calculations, e.g. slope, intercept, R2, to analyze data.

Sample use cases:

1. Calculate the rate of withdrawal from oil wells to stay within compliance limits

2. Calculate linear performance curve based on normalized production to normalized energy consumption to determine motors that are failing

3. Determine when a manufacturing process has reset based on when a slope flattens out

4. Help operators control plant by looking at slope. Currently using an Excel spreadsheet that must be constantly refreshed.

The slope and intercept calculations in combination with PI Sever's support for predictive data would be cool. Imagine being able to extrapolate historical data and identify whether you're on a fast track to success or failure.

The components that could go into the separate calculations of slope, intercept, r, and r^2 are similar to current calculations for standard deviation (StDev already exists in Asset Analytics).

In addition to StDev, Excel has the following functions--

· Slope(known Y's, known X's)

· Intercept(Y's, X's)

· RSQ(Y's, X's) – r^2

· Correl(Y's, X's) – correlation, r

Idea:

Add basic out-of-the-box calculations in Asset Analytics that mirrors Excel functions for linear regression with a syntax of (attribute, start time, end time, optional: % good). Construct is similar to the current equation in Asset Analytics, StdDev.

- Slope(attribute, start time, end time, optional: % good)
- Intercept( )
- RSQ( )

More complex expressions would be better in specific packages, but those 3 would be strong building blocks.

Folks from Linear Regression in AF , what do you think?

## Comments