Code covered by the BSD License

### Highlights from gqqplot

4.75
4.8 | 5 ratings Rate this file 11 Downloads (last 30 days) File Size: 2.28 KB File ID: #18699 Version: 1.0

# gqqplot

### Francisco de Castro (view profile)

11 Feb 2008 (Updated )

GQQPLOT Display a generic Q-Q plot of sample vs. distribution

File Information
Description

GQQPLOT(X,DIST) makes an plot of the quantiles of the data set X versus the inverse of the cdf of a distribution specified in DIST, evaluated at probabilities equal to the quantiles of X. The parameters of the distribution are calculated from X.

The purpose of the QQ plot is to determine whether the sample in X is drawn from a given distribution. If it is, the plot will be linear. In the case of the Binomial distribution, an additional parameter is needed: N, number of trials, e.g. GQQPLOT(X,'binom',N).

The name of the distribution can be (case insensitive):

'norm' or 'normal'
'gam' or 'gamma'
'logn' or 'Lognormal',
'exp' or 'Exponential',
'wbl' or 'Weibull'.
'beta'
'bin' or 'Binomial'
'ev' or 'Extreme Value',
'gev' or 'Generalized Extreme Value',
'gp' or 'Generalized Pareto',
'nbin' or 'Negative Binomial',
'poiss' or 'poisson'
'unif' or 'uniform'
'rayl' or 'rayleigh'

EXAMPLE:
x= gamrnd(2,0.5,1000,1);
gqqplot(x,'gamma') %Good fit

Required Products Statistics and Machine Learning Toolbox
MATLAB release MATLAB 7.4 (R2007a)
30 Dec 2014 Markus Gschwind

### Markus Gschwind (view profile)

@Markus - just to follow up on this: The staircase shape is due to binned data when there are only few bins... Not a problem of gqqplot of course!
Thanks Francisco!

Comment only
10 Nov 2014 Markus Gschwind

### Markus Gschwind (view profile)

Great function!!! But I have on bizzare observation: The data I enter are sometimes and sometimes NOT strongly binned, i.e. a stairshape of the y-axis (empiric) data. I am not sure where this behavior comes from, and if it is possible to get rid of!

14 Jun 2012 Pio Nonus

### Pio Nonus (view profile)

very useful indeed

03 Apr 2012 Carl Witthoft

### Carl Witthoft (view profile)

Question: If I'm reading the code correctly, selecting e.g. a normal distribution causes the code to generate a reference distribution with a mean and sigma calculated from my input dataset. A QQplot should let me compare my normal distribution to a reference set with specified mean and sigma. If I'm wrong, please let me know; if I'm right, can you modify your code?
thanks
Carl

Comment only

Francisco: I got it fixed and is working great...Had some nans in my data and I didn't notice.....cheers

there are electricity load data...they are totally 280514 records...missing data points and outliers have been removed...I just see an empty figure without any error message

Comment only
10 Nov 2011 Francisco de Castro

### Francisco de Castro (view profile)

Mehdi: Are there any errors? What's in your "large vectors"?

Comment only