Basic Linear Regression: Slope, Intercept, and R-squared
Wondering if there's interest in basic linear regression calculations, e.g. slope, intercept, R2, to analyze data.
Sample use cases:
- Calculate the rate of withdrawal from oil wells to stay within compliance limits
- Calculate linear performance curve based on normalized production to normalized energy consumption to determine motors that are failing
- Determine when a manufacturing process has reset based on when a slope flattens out
- 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
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.
This is in PI Server 2017 R2, available now on https://techsupport.osisoft.com/
Please start a new idea for other feature requests.
You need to install AF 2017 R2 including the accompanying PI Analysis Service 2017 R2. Once you have done that, the name of the function is LinRegr
Timothy Heck commented
Is there any documentation around the names of the new functions? I have a sandbox server setup with AF 2017R2 but don't see any functions in PSE that relate to this
Osvaldo Bascur commented
What about a second order regression to do filtering of a signal?
We have an example running in PI AF doing fault diagnosis.
I have the code and implementation.
Daniel Gougeon commented
This would be a great analytic tool to trigger valve maintenance when the controller output does not track actual valve position.