How to compare two data sets with statistics?

In summary, the conversation revolves around using statistics to determine the accuracy of measured data compared to a reference spectrum. The main question is whether it is appropriate to use the calculation r2=1-(\sum(y-ymodel)2/\sum(y-yavg)2) or if there are other goodness of fit tests that would be more suitable for this situation. The individual answering the questions suggests using the coefficient of determination test or chi-squared test, but also mentions the possibility of using other tests depending on the specific circumstances. They also recommend looking into the inverse problems papers for more information on different approaches to determining goodness of fit.
  • #1
elegysix
406
15
I have two questions:

I have a set of data, a measured spectrum. When I model the spectrum with a function, I calculate r2=1-([itex]\sum[/itex](y-ymodel)2/[itex]\sum[/itex](y-yavg)2).

Q1) However, I have reference data now, which is what the spectrum should be. So is it right to use the same calculation on it for r2, but instead of using ymodel, using yreference?

Q2) The model function I was fitting to the data is
Sλ = 2πhc25(ehc/λkT-1)
Is it correct to calculate goodness of fit in that way for such a distribution?


Here is a plot of my two data sets

unnamed.jpg


thanks!
 
Physics news on Phys.org
  • #2
Q1> what does it mean: "what the spectrum should be"
There is what the spectrum is and what the model predicts - surely it "should be" whatever it actually is.

Q2> To decide what to do you need, first, to define the problem.
What is it you are trying to find out?

If you want to see if the model is a good fit to the data, then a goodness fit is probably warranted.
Make sure that the approach you use answers the questions you are asking.

What I am reading above is that you have not asked a clear enough question to know how to proceed.

Suspect you may need these:
http://home.comcast.net/~szemengtan/
... "Inverse Problems" towards the bottom of the page.

Those data plots are seriously cool btw.
 
Last edited by a moderator:
  • #3
Thanks, sorry for being unclear.
Forget that I mentioned a "model"

"what the spectrum should be" is the ASTMG173.
We captured the solar spectrum and want to compare it with a reference spectrum (the ASTMG173) to show that our measurements are accurate.

the question is - how can I properly use statistics to say how well these two data sets match?

Is it appropriate to use this calculation: [itex]r^{2} = 1 - \frac{\sum(y_{r} - y_{s})^{2} }{\sum(y_{r} - \bar{y_{r}})^{2} } [/itex]

where [itex] y_{r} [/itex] is the reference y data, and [itex] y_{s} [/itex] is our measured y data, and [itex] \bar{y_{r}} [/itex] is the mean of the reference y data.

thanks
 
  • #4
So you are testing the measuring method, to show that it is sound?

You want to use the coefficient of determination test?
I think you have the roles of the data-sets reversed.

There are other goodness of fit tests - i.e. chi-squared - what lead you to choose this one?
 
  • #5
Simon Bridge said:
So you are testing the measuring method, to show that it is sound?
yes.

Simon Bridge said:
You want to use the coefficient of determination test?
Not necessarily. I want to use whatever test is appropriate for this.


Simon Bridge said:
There are other goodness of fit tests - i.e. chi-squared - what lead you to choose this one?
I am not familiar with the others, that is why I made this thread. Which test should I use? what would you use?

thanks
 
  • #6
I see ... I cannot see anything immediately ruling out a CoD test.
I would use Chi-squared... but that's me.

Really you are comparing two data-sets and asking if they are close enough to come from the same forward function rather than checking a data set against a theoretical model of a forward function.

The inverse problems papers I linked you to (post #2) gives a lot of detail on different rationales for goodness of fit in different circumstances.
 

Related to How to compare two data sets with statistics?

1. How do I determine which statistical test to use?

To compare two data sets, you first need to identify the type of data you have and the question you are trying to answer. Based on this information, you can choose from a variety of statistical tests such as t-tests, ANOVA, or chi-square tests. It is important to consult with a statistician or research guide to determine the most appropriate test for your specific data and research question.

2. What is the significance level and how do I choose it?

The significance level, also known as alpha, is the threshold at which you reject the null hypothesis in favor of the alternative hypothesis. The most commonly used significance level is 0.05, which means that if the p-value is less than 0.05, we can reject the null hypothesis and conclude that there is a significant difference between the two data sets. However, the significance level can be adjusted based on the study design and research question.

3. How do I interpret the results of a statistical test?

The results of a statistical test will typically include a p-value and a confidence interval. The p-value indicates the probability of obtaining the observed results by chance if the null hypothesis is true. A p-value less than the significance level suggests that there is a significant difference between the two data sets. The confidence interval provides a range of values in which the true difference between the two groups is likely to fall. A narrower confidence interval indicates a more precise estimate of the difference.

4. Can I compare data sets with different sample sizes?

Yes, you can compare data sets with different sample sizes. However, you must consider the sample size when interpreting the results. A larger sample size will provide a more accurate representation of the population, while a smaller sample size may lead to a wider confidence interval and less precise results. It is important to report the sample sizes of both data sets when presenting the results.

5. What if my data is not normally distributed?

If your data is not normally distributed, you may need to use a non-parametric statistical test, such as the Wilcoxon rank-sum test or the Mann-Whitney U test, instead of a parametric test. These tests do not assume a normal distribution of the data and are better suited for non-parametric data. It is important to evaluate the distribution of your data and choose an appropriate test accordingly.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
6
Views
859
  • Set Theory, Logic, Probability, Statistics
Replies
11
Views
969
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
4K
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
8
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
20
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
28
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
16
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
505
Back
Top