Clear Filters
Clear Filters

Creating a normal distribution and chi^2 test

7 views (last 30 days)
I have a single set of data with 369 values. I want to be able to analyze this, but since there was only one set, I don't believe I can performa any statistical test on the set that would benefit me. So I want to creat a normal distribution using the already known standard deviation and mean. Then I want to perform a chi-squared test on this sample against the data I already have.
I know of the hist command, but dont really think I can use that with just the mean and standard deviation. I found this somewhere but not really sure if this is correct or anything. Any help?
mu = 0.118733568;
sd = 0.141034278;
ix = -3*sd:1e-3:3*sd; %covers more than 99% of the curve
iy = pdf('normal', ix, mu, sd);
plot(ix,iy);
  1 Comment
Dimitri
Dimitri on 5 Mar 2013
Ohh, and two last things, those values for mu and sd are my values for my mean and standard deviation. Also, my original data is in the form of a histogram made up of 13 columns (bins). Not sure if that means anything. Thanks in advance

Sign in to comment.

Accepted Answer

Wayne King
Wayne King on 5 Mar 2013
Edited: Wayne King on 5 Mar 2013
Why do you think you cannot perform any statistical test that will benefit you when you have 369 measurements?
In many contexts, a single data set consisting of 369 measurements is a lot of data.
What hypothesis about your data are you interested in testing.
You mention the chi-square goodness of fit test, if you have the Statistics Toolbox, you can test the assumption that you are data follow a normal distribution with the sample mean and standard deviation
For example:
x = 10+0.5*randn(369,1);
[h,p] = chi2gof(x,'cdf',{@normcdf,mean(x),std(x)});
The above is assuming that x is your data (369 values). You'll see above that h is equal to 0 which means you cannot reject the null hypothesis that the data follow a normal distribution with mean(x) and std(x)
Now consider:
x = 10+0.5*rand(369,1);
[h,p] = chi2gof(x,'cdf',{@normcdf,mean(x),std(x)});
  1 Comment
Dimitri
Dimitri on 5 Mar 2013
Thank you very much, that's what i was looking for. I got an h value of 1, and p of 4.7999e-020. So it does not follow the normal distribution.
Also, as to your question, I was interested in testing it's variance, how close it is to a normal distribution, or pretty much anything that gives me a good understanding of the data. This test was my main concern though. Thanks again

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!