How to calculate slope for data set

  • Context: Undergrad 
  • Thread starter Thread starter member 428835
  • Start date Start date
  • Tags Tags
    Data Set Slope
Click For Summary
SUMMARY

The discussion focuses on calculating the slope of a dataset using the formula (y_{i+1}-y_{i-1})/(2 Δx). The user encounters issues due to measurement errors causing repeated y-values in a small domain. Two recommended solutions include fitting a curve to the data using optimization techniques, akin to non-linear regression, and aggregating data into bins to plot average values. These methods aim to enhance the accuracy of slope calculations for scientific publication.

PREREQUISITES
  • Understanding of slope calculation in data analysis
  • Familiarity with optimization techniques for curve fitting
  • Knowledge of non-linear regression methods
  • Experience with data aggregation and binning techniques
NEXT STEPS
  • Research optimization techniques for curve fitting using tools like Python's SciPy library
  • Learn about non-linear regression methods and their applications in data analysis
  • Explore data aggregation techniques, specifically binning methods for statistical analysis
  • Investigate best practices for handling measurement errors in datasets
USEFUL FOR

Data analysts, researchers, and scientists involved in statistical analysis and curve fitting who need to accurately calculate slopes from datasets with measurement errors.

member 428835
Hi PF!

I have some data (y-value data and x-value data) which I can plot to make a curve (see attachment, the top curve). However, when trying to compute the slope of this data I have an issue (see attachment, the bottom "curve"). The formula I am using for slope is ##(y_{i+1}-y_{i-1})/(2 \Delta x)##.

To me it seems the issue is I have way too much data. Many of the y data values for some small neighborhood in the domain are the same due to measurement errors (measuring can only be so accurate). Should I simply omit all but, say, every 10th data value? Is this scientifically acceptable (results will be published)?

I can explain more if you need. Thanks!
 

Attachments

Physics news on Phys.org
It sounds like what you want to do is to fit a curve to the data. A couple of different things you could do are

1. Find a function with a few parameters that has the broad shape of the curve you drew, then use optimization techniques to estimate those parameters by something like minimizing sums of squares of errors. this is a non-linear equivalent of linear regression.

2. Aggregate data along the horizontal axis into bins and then just plot the average value for all observations in each bin.
 
  • Like
Likes   Reactions: member 428835
Thanks andrewkirk! I'm on it!
 

Similar threads

  • · Replies 53 ·
2
Replies
53
Views
7K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 20 ·
Replies
20
Views
3K
  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 14 ·
Replies
14
Views
2K
Replies
5
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 11 ·
Replies
11
Views
5K
  • · Replies 5 ·
Replies
5
Views
3K