p value for two sets having variable x and y

4 views (last 30 days)
Hello all. I have a question about statistics. I have two sets of data. each set of data has an x and a y value (in more details, for each concentration "x" a surface charge "y" is measured experimentally. and this was done for two different membranes in the experiment). SO: I have a set of x and y for system 1 and a set of x and y for system 2.
My question is: how can make sure that these two sets are significantly different?
I am familiar with the t-test and getting the value of p. how does that work when "x" is not the same for the two sets of data??
Happy to elaborate further if this is not clear and thank you in advance.

Answers (2)

Star Strider
Star Strider on 25 Aug 2021
The most appropriate measure might be the ranksum test if the experiments are unpaired (for example an intervention and control group), and signrank if paired (the same group before and after an intervention).
The advantage of these is that the groups have to have the same distribution, however that distribution may be unknown.
There may be other options as well, however on the basis of the information provided, these would seem to be appropriate.
Star Strider
Star Strider on 25 Aug 2021
I am not certain what the problem is.
Perhaps sharing the data would help.

Sign in to comment.

Scott MacKenzie
Scott MacKenzie on 24 Sep 2021
Edited: Scott MacKenzie on 24 Sep 2021
Since for each system, y is the measured response for x, you can reduce the data for that set to x-y. Also, since the systems use different membranes, the data sets are independent or unpaired. Depending on the assumptions for the underlying data you can use either ttest2, the parametric two-sample t-test, or ranksum, the non-parametric test for unpaired data. Generally, these two tests give the same or similar results. Since the samples are independent, there is no need to have the same number of measurements in each set. Here's an example:
% 10 measurements for system 1
x1 = rand(10,1);
y1 = rand(10,1);
set1 = x1-y1;
% 12 measurements for system 2
x2 = rand(12,1);
y2 = rand(12,1);
set2 = x2-y2;
% parametric test for equal means and variances
[~, p1] = ttest2(set1, set2)
p1 = 0.8889
% non-parametric test for equal medians
p2 = ranksum(set1, set2)
p2 = 0.8175


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!