# class TGraphQQ: public TGraph

```
This class allows to draw quantile-quantile plots

Plots can be drawn for 2 datasets or for a dataset and a theoretical
distribution function

2 datasets:
Quantile-quantile plots are used to determine whether 2 samples come from
the same distribution.
A qq-plot draws the quantiles of one dataset against the quantile of the
the other. The quantiles of the dataset with fewer entries are on Y axis,
with more entries - on X axis.
A straight line, going through 0.25 and 0.75 quantiles is also plotted
for reference. It represents a robust linear fit, not sensitive to the
extremes of the datasets.
If the datasets come from the same distribution, points of the plot should
fall approximately on the 45 degrees line. If they have the same
distribution function, but location or scale different parameters,
they should still fall on the straight line, but not the 45 degrees one.
The greater their departure from the straight line, the more evidence there
is, that the datasets come from different distributions.
The advantage of qq-plot is that it not only shows that the underlying
distributions are different, but, unlike the analytical methods, it also
gives information on the nature of this difference: heavier tails,
different location/scale, different shape, etc.

Some examples of qqplots of 2 datasets:

```
/* */
```
1 dataset:
Quantile-quantile plots are used to determine if the dataset comes from the
specified theoretical distribution, such as normal.
A qq-plot draws quantiles of the dataset against quantiles of the specified
theoretical distribution.
(NOTE, that density, not CDF should be specified)
A straight line, going through 0.25 and 0.75 quantiles can also be plotted
for reference. It represents a robust linear fit, not sensitive to the
extremes of the dataset.
As in the 2 datasets case, departures from straight line indicate departures
from the specified distribution.

" The correlation coefficient associated with the linear fit to the data
in the probability plot (qq plot in our case) is a measure of the
goodness of the fit.
Estimates of the location and scale parameters  of the distribution
are given by the intercept and slope. Probability plots can be generated
for several competing distributions to see which provides the best fit,
and the probability plot generating the highest correlation coefficient
is the best choice since it generates the straightest probability plot."
From "Engineering statistic handbook",
http://www.itl.nist.gov/div898/handbook/eda/section3/probplot.htm

Example of a qq-plot of a dataset from N(3, 2) distribution and
TMath::Gaus(0, 1) theoretical function. Fitting parameters
are estimates of the distribution mean and sigma.

```
/* */
```//

References:
http://www.itl.nist.gov/div898/handbook/eda/section3/qqplot.htm
http://www.itl.nist.gov/div898/handbook/eda/section3/probplot.htm

```

## Function Members (Methods)

public:
protected:
 virtual Double_t** TGraph::Allocate(Int_t newsize) Double_t** TGraph::AllocateArrays(Int_t Narrays, Int_t arraySize) virtual void TGraph::CopyAndRelease(Double_t** newarrays, Int_t ibegin, Int_t iend, Int_t obegin) virtual Bool_t TGraph::CopyPoints(Double_t** newarrays, Int_t ibegin, Int_t iend, Int_t obegin) Bool_t TGraph::CtorAllocate() virtual void TObject::DoError(int level, const char* location, const char* fmt, va_list va) const Double_t** TGraph::ExpandAndCopy(Int_t size, Int_t iend) virtual void TGraph::FillZero(Int_t begin, Int_t end, Bool_t from_ctor = kTRUE) void MakeFunctionQuantiles() void MakeQuantiles() void TObject::MakeZombie() void Quartiles() Double_t** TGraph::ShrinkAndCopy(Int_t size, Int_t iend) virtual void TGraph::SwapPoints(Int_t pos1, Int_t pos2) static void TGraph::SwapValues(Double_t* arr, Int_t pos1, Int_t pos2)

## Data Members

public:
 enum TGraph::[unnamed] { kClipFrame kNotEditable }; enum TObject::EStatusBits { kCanDelete kMustCleanup kObjInCanvas kIsReferenced kHasUUID kCannotPick kNoContextMenu kInvalidObject }; enum TObject::[unnamed] { kIsOnHeap kNotDeleted kZombie kBitMask kSingleKey kOverwrite kWriteDelete };
protected:
 TF1* fF theoretical density function, if specified Color_t TAttFill::fFillColor fill area color Style_t TAttFill::fFillStyle fill area style TList* TGraph::fFunctions Pointer to list of functions (fits and user) TH1F* TGraph::fHistogram Pointer to histogram used for drawing axis Color_t TAttLine::fLineColor line color Style_t TAttLine::fLineStyle line style Width_t TAttLine::fLineWidth line width Color_t TAttMarker::fMarkerColor Marker color index Size_t TAttMarker::fMarkerSize Marker size Style_t TAttMarker::fMarkerStyle Marker style Int_t TGraph::fMaxSize !Current dimension of arrays fX and fY Double_t TGraph::fMaximum Maximum value for plotting along y Double_t TGraph::fMinimum Minimum value for plotting along y TString TNamed::fName object identifier Int_t TGraph::fNpoints Number of points <= fMaxSize Int_t fNy0 size of the fY0 dataset TString TNamed::fTitle object title Double_t* TGraph::fX [fNpoints] array of X points Double_t fXq1 x1 coordinate of the interquartile line Double_t fXq2 x2 coordinate of the interquartile line Double_t* TGraph::fY [fNpoints] array of Y points Double_t* fY0 !second dataset, if specified Double_t fYq1 y1 coordinate of the interquartile line Double_t fYq2 y2 coordinate of the interquartile line

## Function documentation

TGraphQQ(const TGraphQQ& )
```default constructor
```
TGraphQQ(Int_t n, Double_t* x)
```Creates a quantile-quantile plot of dataset x.
Theoretical distribution function can be defined later by SetFunction method
```
TGraphQQ(Int_t n, Double_t* x, TF1* f)
```Creates a quantile-quantile plot of dataset x against function f
```
TGraphQQ(Int_t nx, Double_t* x, Int_t ny, Double_t* y)
```Creates a quantile-quantile plot of dataset x against dataset y
Parameters nx and ny are respective array sizes
```

```Destroys a TGraphQQ
```
void MakeFunctionQuantiles()
```Computes quantiles of theoretical distribution function
```
void MakeQuantiles()
```When sample sizes are not equal, computes quantiles of the bigger sample
by linear interpolation
```
void Quartiles()
``` compute quartiles
a quartile is a 25 per cent or 75 per cent quantile
```
void Paint(Option_t* opt = "")
``` paint this graphQQ. No options for the time being
```
void SetFunction(TF1* f)
```Sets the theoretical distribution function (density!)
and computes its quantiles
```
TGraphQQ(const TGraphQQ& )

Author: Anna Kreshuk 18/11/2005
Last change: root/graf:\$Id: TGraphQQ.h 20882 2007-11-19 11:31:26Z rdm \$
Last generated: 2008-06-25 08:46