Clear Filters
Clear Filters

Extract samples with normal distribution from dataset

5 views (last 30 days)
I have a dataset, of let's say, 86 samples caracterised by 1 value each (and other data, not important here). Plotting a barplot shows me that the 86 values do not follow a normal distribution. I'd like to find some code to extract from these 86 values a number n of values that follow as close as possible a normal distribution. If possible, I'd also like to be able to spectify the parameter n. Thank you for your help.

Answers (1)

Paul Peeling
Paul Peeling on 13 Dec 2011
You could use NCHOOSEK to generate subsets from your dataset with the desired number of samples, and then for each subset run a normality hypothesis test from the Statistics toolbox, and choose any subsets which meet your chosen level of significance
If your dataset is much larger, you could use outlier detection if you expect your dataset to have a mostly normal distribution. If the data is skewed or heavy-tailed, you should consider modeling and fitting the actual distribution.
  2 Comments
Sebastien
Sebastien on 13 Dec 2011
Indeed, but what about if I do not have the statistics toolbox ?
I was more thinking about some code that automatically checks and calculate the best fit to a normal distribution....That would be great !!!!!
Paul Peeling
Paul Peeling on 14 Dec 2011
If you don't have the Statistics toolbox, many normality tests are available on the File Exchange. Here is one for the chi-squared test: http://www.mathworks.com/matlabcentral/fileexchange/4779-chi-square-test

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!