StatProbPlots::StatQQPlot Function

Overload List

#SignatureDescription
1void StatQQPlot(TVec *XData, TVec *YData, TVec *XDrawVec, TVec *YDrawVec, double &MinX, double &MaxX, double &MinY, double &MaxY, const bool XDataSorted = true, const bool YDataSorted = true);Constructs the Quantile-Quantile probability plot.
2void StatQQPlot(TVec *Data, TVec *XDrawVec, TVec *YDrawVec, double &MinX, double &MaxX, double &MinY, double &MaxY, const bool DataSorted = true);Constructs an Q-Q plot of the quantiles of the data set Data againsts the quantiles of a standard Normal distribution.

Overload 1: void StatQQPlot(TVec *XData, TVec *YData, TVec *XDrawVec, TVec *YDrawVec, double &MinX, double &MaxX, double &MinY, double &MaxY, const bool XDataSorted = true, const bool YDataSorted = true);

Constructs the Quantile-Quantile probability plot.

#NameTypeDescription
1XDataTVec *X Data (first dataset).
2YDataTVec *Y Data (second dataset).
3XDrawVecTVec *Returns q-q plot horizontal values to be drawn - > estimated quantiles from XData vector or in this case sorted XData values.
4YDrawVecTVec *Returns q-q plot vertical values to be drawn - > estimated quantiles from YData vector or in this case sorted YData values.
5MinXdouble &Returns slope line start X point, XDrawVec 25th percentile. These value are used by Dew.Stats.Tee.ProbabilityPlot series.
6MaxXdouble &Returns slope line end X point, XDrawVec 75th percentile. These value are used by Dew.Stats.Tee.ProbabilityPlot series.
7MinYdouble &Returns slope line start Y point, YDrawVec 25th percentile. These value are used by Dew.Stats.Tee.ProbabilityPlot series.
8MaxYdouble &Returns slope line end Y point, YDrawVec 75th percentile. These value are used by Dew.Stats.Tee.ProbabilityPlot series.
9XDataSorted = trueconst boolIf true, algorithm assumes XData is already sorted in ascending order. If XData is not sorted, you must set this parameter to false so that internal algorithm will automatically do the sorting.
10YDataSorted = trueconst boolIf true, algorithm assumes YData is already sorted in ascending order. If YData is not sorted, you must set this parameter to false so that internal algorithm will automatically do the sorting.
Remarks:

Constructs the Quantile-Quantile Chart. Use TStatProbSeries to visualize/plot constructed values. The QQ chart is a graphical technique for determining if two data sets come from populations with a common distribution. Specifically, QQ chart is a plot of the quantiles of the first data set against the quantiles of the second data set. By a quantile, we mean the fraction (or percent) of points below the given value. That is, the 0.3 (or 30%) quantile is the point at which 30% percent of the data fall below and 70% fall above that value. A 45-degree reference line is also plotted. If the two sets come from a population with the same distribution, the points should fall approximately along reference line. The greater the departure from this reference line, the greater the evidence for the conclusion that the two data sets have come from populations with different distributions.

The advantages of the q-q plot are:

  • The sample sizes do not need to be equal.
  • Many distributional aspects can be simultaneously tested. For example, shifts in location, shifts in scale, changes in symmetry, and the presence of outliers can all be detected from this plot. For example, if the two data sets come from populations whose distributions differ only by a shift in location, the points should lie along a straight line that is displaced either up or down from the 45-degree reference line.

The QQ Chart is similar to a probability plot. For a probability plot, the quantiles for one of the data samples are replaced with the quantiles of a theoretical distribution. The QQ chart is used to answer the following questions:

  • Do two data sets come from populations with a common distribution?
  • Do two data sets have common location and scale?
  • Do two data sets have similar distributional shapes?
  • Do two data sets have similar tail behavior?

When there are two data samples, it is often desirable to know if the assumption of a common distribution is justified. If so, then location and scale estimators can pool both data sets to obtain estimates of the common location and scale. If two samples do differ, it is also useful to gain some understanding of the differences. The QQ Chart can provide more insight into the nature of the difference than analytical methods such as the Statistics::GOFChi2Test and Statistics::GOFKolmogorov two sample tests.

If the data sets have the same size, the q-q plot is essentially a plot of sorted X against sorted Y. If the data sets are not of equal size, the quantiles are usually picked to correspond to the sorted values from the smaller data set and then the quantiles for the larger data set are interpolated.

How to construct two datasets Q-Q plot?

  • If needed, XData values or YData are sorted (DataSorted parameter set to false).
  • Abscissa drawing values are formed by estimated XData quantiles - ordered XData values. After calculation they are copied to XDrawVec. TMtxVecBase::Length and TMtxVec::Complex properties of XDrawVec are adjusted automatically.
  • Ordinate drawing values are formed by estimated YData quantiles - ordered YData values. After calculation they are copied to YDrawVec. TMtxVecBase::Length and TMtxVec::Complex properties of YDrawVec are adjusted automatically.
  • XDrawVec and YDrawVec 25th and 75th percentile points are used to construct a reference line. Drawing points departures from this straight line indicate XData and YData do not come from the same distribution.
See Also: Dew.Stats.Tee.ProbabilityPlot
Declared in Dew::Stats::Units::StatProbPlots · Dew.Stats/Units.StatProbPlots.h · Cross-compiler

Overload 2: void StatQQPlot(TVec *Data, TVec *XDrawVec, TVec *YDrawVec, double &MinX, double &MaxX, double &MinY, double &MaxY, const bool DataSorted = true);

Constructs an Q-Q plot of the quantiles of the data set Data againsts the quantiles of a standard Normal distribution.

#NameTypeDescription
1DataTVec *
2XDrawVecTVec *
3YDrawVecTVec *
4MinXdouble &
5MaxXdouble &
6MinYdouble &
7MaxYdouble &
8DataSorted = trueconst bool
Remarks:

How to construct Q-Q normal distribution probability plot?

  • If needed, Data values are sorted (DataSorted parameter set to false).
  • Abscissa drawing values are formed by estimated data quantiles - ordered Data values. After calculation they are copied to XDrawVec. TMtxVecBase::Length and TMtxVec::Complex properties of XDrawVec are adjusted automatically.
  • Ordinate drawing values are formed by using theoretical probabilitie p i.e the so Z values. After calculation they are copied to XDrawVec. TMtxVecBase::Length and TMtxVec::Complex properties of XDrawVec are adjusted automatically.
  • XDrawVec and YDrawVec 25th and 75th percentile points are used to construct a reference line. Drawing points departures from this straight line indicate departures from normality.

Note:
Use this overload if you want to check if specific data comes from standard Normal distribution (mean = 0, sigma^2 = 1.0)

Declared in Dew::Stats::Units::StatProbPlots · Dew.Stats/Units.StatProbPlots.h · Cross-compiler