- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Calculating linear regression slope in formula
Hello,
I was wondering if there was a way to calculate the linear regression slope of column data within a data table formula.
A simple example of the table is below. The data is ordered and I would like to calculate the slope of a fit line of volume over time using the current row's data and previous points to perform the regression.
The idea is that I would like to see the how the calculated slope changes with increasing the number of data points. From doing this manually, the slope values end up approaching a given value and stay within +/-5% after 20 or so points.
Instance | Time (s) | Volume (mL) | Slope (mL/s) |
1 | 0 | 0 | n/a |
2 | 5 | 0.5 | m1 |
3 | 10 | 0.8 | m2 |
... | ... | ... | ... |
N | T | V | mN-1 |
If that is possible, my next challenge would be to set this up so that I can calculate the slope formula so that it uses N data points on either side of the current row for a symmetrical moving calculation instead.
Thank you in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Calculating linear regression slope in formula
This is interesting.. if I wanted to apply a p-value to this... based on null hypothesis (slope = 0)... is there a way to integrate this into forumula?
In other words, I would like to see when the moving slope is changing significantly based on confidence interval around slope
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Calculating linear regression slope in formula
Fantastic solution to EXACTLY what I wanted to do. Thank you!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Calculating linear regression slope in formula
Folks interested in this problem may want to consider supporting the wish idea:
https://community.jmp.com/t5/JMP-Wish-List/Moving-Rolling-Window-Statistics/idi-p/722620
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Calculating linear regression slope in formula
Hi,
You mention a "span of 3", if we want to modify it to be moving slope of "N" samples, which value will need to change?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Calculating linear regression slope in formula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Calculating linear regression slope in formula
J() is a function that creates a matrix of identical values. The default is 1.
|| is an operator that indicate concatenation. So in Mark's example he is concatenating 2 matrices.
These functions and operators are fully documented in the Scripting Guide
Help==>JMP Document Library ….. Scripting Guide
- « Previous
- Next »