0

I have an Output sample for electronic components and I would like to know the p-value for robust my system is. Ideally, I would like to get a p-value (P<0.05) to prove that my system can constantly produce the same results. Noting, my data samples are small.

My Output:

sample=[2.180213,2.178298   ,2.310851   ,2.114255   ,3.012553   ,2.69234    ,2.079787];

I tried using :

[h,p] = chi2gof(sample,'CDF',pd)
[h,p,ci,stats] = ttest(x)
[h,p,stats] = fishertest(x)
[h,p,ksstat,cv] = kstest(___)

I am lost! what kind of test do I perform on MATLAB to truly test how close my outputs are from each other and how consistent my system output is (using p-value)?

Edit: I tried this:

sample=[2.180213,2.178298   ,2.310851   ,2.114255   ,3.012553   ,2.69234    ,2.079787];
n = numel(sample);
xobs = mean(sample);  % Sample mean
s = std(sample);     % Sample standard deviation
[h,p] = ttest(sample,xobs)

The result is:

h =

     0


p =

     1

My numbers are kind of close to each other but the results do not make sense. h = 0 means that the mean is true and not rejected, but the p-value is 1! Why is it high!

  • 1
    Unless you are comparing two samples (set of observations). In your question you have one sample consisting of 7 observations. You could compute standard-deviation (std) or standard-error (to get a sense of variability). However, with a single sample you could test the hypothesis that the sample mean using a 1-sample t-test. – Azim J Sep 15 '21 at 21:22
  • I thought the 1-sample t-test is for when the data in x comes from a normal distribution with a mean equal to zero. however, my mean is not zero @AzimJ – Anwar Elhadad Sep 15 '21 at 21:58
  • yes the generic 1-sample t-test assumes a mean of zero. You could either shift your data to have zero mean (ie subtract the expected mean from your data points) or in MATLAB use `ttest(x,m)` where `x` is your sample and `m` the expected mean (https://www.mathworks.com/help/stats/ttest.html - see `ttest(x,m)` for testing non-zero mean ). The data still needs to come from a normally distributed population. – Azim J Sep 15 '21 at 22:51
  • You are testing whether your data comes from a normal distribution with mean `xobs`, which it looks like because you determined `xobs` from your samples. That is to say, your test makes no sense. I highly suggest you study statistics before you randomly apply statistical tests without knowing what they mean. Note that applying a test and getting a p<0.05 proves nothing. The test tells you whether you can or cannot discard your hypothesis. It’s not a proof, it’s evidence. – Cris Luengo Sep 15 '21 at 23:22
  • 1
    The only thing you can do with your data is compute a mean and a standard deviation, and determine if your mean is close enough to the expected mean, and your standard deviation is small enough for your requirements. Or you can see if there’s a trend in the data (mean value changes over time). If you must apply a statistical test, you can compare your data to an expected distribution. But it looks like you don’t have one of those, you don’t even know what mean you expect? – Cris Luengo Sep 15 '21 at 23:26
  • The p-value is the probability of the observed data given that the null hypothesis is true, which is a probability that measures the consistency between the data. I tried looking p-value However, all examples are for testing data vs data. However, not to measure reliability within the same data. – Anwar Elhadad Sep 15 '21 at 23:28
  • The mean I am expecting is the mean of the total samples. For my application, it makes the most sense. I want to do a statistical test to show that there is not a lot of variation between the values. – Anwar Elhadad Sep 15 '21 at 23:30
  • Anwar: If you want to know if the variation is within an acceptable range, then as @Cris Luengo suggests you would need to compute the standard-deviation and/or standard-error and check that these are smaller enough for your application. All the t-test will tell you is the probability that your sample comes from a normally distributed population with a given mean. – Azim J Sep 17 '21 at 00:55

1 Answers1

0

I believe I figured It out. I selected an arbitrary mean which is my desired value to outputted Ideally and use it as the hypothesis condition.

sample=[2.180213,2.178298   ,2.310851   ,2.114255   ,3.012553   ,2.69234    ,2.079787];
n = numel(sample);
xobs = mean(sample);  % Sample mean
s = std(sample);     % Sample standard deviation
[h,p] = ttest(sample,3)