# 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:
 TGraphQQ() TGraphQQ(const TGraphQQ&) TGraphQQ(Int_t n, Double_t* x) TGraphQQ(Int_t n, Double_t* x, TF1* f) TGraphQQ(Int_t nx, Double_t* x, Int_t ny, Double_t* y) virtual ~TGraphQQ() void TObject::AbstractMethod(const char* method) const virtual void TObject::AppendPad(Option_t* option = "") virtual void TGraph::Apply(TF1* f) virtual void TGraph::Browse(TBrowser* b) virtual Double_t TGraph::Chisquare(const TF1* f1) const static TClass* Class() virtual const char* TObject::ClassName() const virtual void TNamed::Clear(Option_t* option = "") virtual TObject* TNamed::Clone(const char* newname = "") const virtual Int_t TNamed::Compare(const TObject* obj) const static Bool_t TGraph::CompareArg(const TGraph* gr, Int_t left, Int_t right) static Bool_t TGraph::CompareRadius(const TGraph* gr, Int_t left, Int_t right) static Bool_t TGraph::CompareX(const TGraph* gr, Int_t left, Int_t right) static Bool_t TGraph::CompareY(const TGraph* gr, Int_t left, Int_t right) void TGraph::ComputeLogs(Int_t npoints, Int_t opt) virtual void TGraph::ComputeRange(Double_t& xmin, Double_t& ymin, Double_t& xmax, Double_t& ymax) const virtual void TNamed::Copy(TObject& named) const virtual void TObject::Delete(Option_t* option = "") Int_t TAttLine::DistancetoLine(Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2) virtual Int_t TGraph::DistancetoPrimitive(Int_t px, Int_t py) virtual void TGraph::Draw(Option_t* chopt = "") virtual void TObject::DrawClass() const virtual TObject* TObject::DrawClone(Option_t* option = "") const virtual void TGraph::DrawGraph(Int_t n, const Int_t* x, const Int_t* y, Option_t* option = "") virtual void TGraph::DrawGraph(Int_t n, const Float_t* x, const Float_t* y, Option_t* option = "") virtual void TGraph::DrawGraph(Int_t n, const Double_t* x = 0, const Double_t* y = 0, Option_t* option = "") virtual void TGraph::DrawPanel() virtual void TObject::Dump() const virtual void TObject::Error(const char* method, const char* msgfmt) const virtual Double_t TGraph::Eval(Double_t x, TSpline* spline = 0, Option_t* option = "") const virtual void TObject::Execute(const char* method, const char* params, Int_t* error = 0) virtual void TObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0) virtual void TGraph::ExecuteEvent(Int_t event, Int_t px, Int_t py) virtual void TGraph::Expand(Int_t newsize) virtual void TGraph::Expand(Int_t newsize, Int_t step) virtual void TObject::Fatal(const char* method, const char* msgfmt) const virtual void TNamed::FillBuffer(char*& buffer) virtual TObject* TGraph::FindObject(const char* name) const virtual TObject* TGraph::FindObject(const TObject* obj) const virtual Int_t TGraph::Fit(const char* formula, Option_t* option = "", Option_t* goption = "", Axis_t xmin = 0, Axis_t xmax = 0) virtual Int_t TGraph::Fit(TF1* f1, Option_t* option = "", Option_t* goption = "", Axis_t xmin = 0, Axis_t xmax = 0) virtual void TGraph::FitPanel() virtual Double_t TGraph::GetCorrelationFactor() const virtual Double_t TGraph::GetCovariance() const virtual Option_t* TObject::GetDrawOption() const static Long_t TObject::GetDtorOnly() Bool_t TGraph::GetEditable() const virtual Double_t TGraph::GetErrorX(Int_t bin) const virtual Double_t TGraph::GetErrorXhigh(Int_t bin) const virtual Double_t TGraph::GetErrorXlow(Int_t bin) const virtual Double_t TGraph::GetErrorY(Int_t bin) const virtual Double_t TGraph::GetErrorYhigh(Int_t bin) const virtual Double_t TGraph::GetErrorYlow(Int_t bin) const virtual Double_t* TGraph::GetEX() const virtual Double_t* TGraph::GetEXhigh() const virtual Double_t* TGraph::GetEXlow() const virtual Double_t* TGraph::GetEY() const virtual Double_t* TGraph::GetEYhigh() const virtual Double_t* TGraph::GetEYlow() const virtual Color_t TAttFill::GetFillColor() const virtual Style_t TAttFill::GetFillStyle() const TF1* TGraph::GetFunction(const char* name) const TH1F* TGraph::GetHistogram() const virtual const char* TObject::GetIconName() const virtual Color_t TAttLine::GetLineColor() const virtual Style_t TAttLine::GetLineStyle() const virtual Width_t TAttLine::GetLineWidth() const TList* TGraph::GetListOfFunctions() const virtual Color_t TAttMarker::GetMarkerColor() const virtual Size_t TAttMarker::GetMarkerSize() const virtual Style_t TAttMarker::GetMarkerStyle() const Int_t TGraph::GetMaxSize() const virtual Double_t TGraph::GetMean(Int_t axis = 1) const Int_t TGraph::GetN() const virtual const char* TNamed::GetName() const virtual char* TObject::GetObjectInfo(Int_t px, Int_t py) const static Bool_t TObject::GetObjectStat() virtual Option_t* TObject::GetOption() const virtual void TGraph::GetPoint(Int_t i, Double_t& x, Double_t& y) const virtual Double_t TGraph::GetRMS(Int_t axis = 1) const virtual const char* TNamed::GetTitle() const virtual UInt_t TObject::GetUniqueID() const Double_t* TGraph::GetX() const TAxis* TGraph::GetXaxis() const Double_t* TGraph::GetY() const TAxis* TGraph::GetYaxis() const virtual Bool_t TObject::HandleTimer(TTimer* timer) virtual ULong_t TNamed::Hash() const virtual void TObject::Info(const char* method, const char* msgfmt) const virtual Bool_t TObject::InheritsFrom(const char* classname) const virtual Bool_t TObject::InheritsFrom(const TClass* cl) const virtual void TGraph::InitExpo(Double_t xmin = 0, Double_t xmax = 0) virtual void TGraph::InitGaus(Double_t xmin = 0, Double_t xmax = 0) virtual void TGraph::InitPolynom(Double_t xmin = 0, Double_t xmax = 0) virtual Int_t TGraph::InsertPoint() virtual void TObject::Inspect() const void TObject::InvertBit(UInt_t f) virtual TClass* IsA() const virtual Bool_t TGraph::IsEditable() const virtual Bool_t TObject::IsEqual(const TObject* obj) const virtual Bool_t TObject::IsFolder() const Bool_t TObject::IsOnHeap() const virtual Bool_t TNamed::IsSortable() const virtual Bool_t TAttFill::IsTransparent() const Bool_t TObject::IsZombie() const virtual void TGraph::LeastSquareFit(Int_t m, Double_t* a, Double_t xmin = 0, Double_t xmax = 0) virtual void TGraph::LeastSquareLinearFit(Int_t n, Double_t& a0, Double_t& a1, Int_t& ifail, Double_t xmin = 0, Double_t xmax = 0) virtual void TNamed::ls(Option_t* option = "") const void TObject::MayNotUse(const char* method) const virtual Int_t TGraph::Merge(TCollection* list) virtual void TAttLine::Modify() virtual Bool_t TObject::Notify() static void TObject::operator delete(void* ptr) static void TObject::operator delete(void* ptr, void* vp) static void TObject::operator delete[](void* ptr) static void TObject::operator delete[](void* ptr, void* vp) void* TObject::operator new(size_t sz) void* TObject::operator new(size_t sz, void* vp) void* TObject::operator new[](size_t sz) void* TObject::operator new[](size_t sz, void* vp) TGraphQQ& operator=(const TGraphQQ&) virtual void Paint(Option_t* opt = "") virtual void TGraph::PaintFit(TF1* fit) virtual void TGraph::PaintGraph(Int_t npoints, const Double_t* x, const Double_t* y, Option_t* option = "") virtual void TGraph::PaintGrapHist(Int_t npoints, const Double_t* x, const Double_t* y, Option_t* option = "") virtual void TGraph::PaintPolyLineHatches(Int_t n, const Double_t* x, const Double_t* y) virtual void TObject::Pop() virtual void TGraph::Print(Option_t* chopt = "") const virtual Int_t TObject::Read(const char* name) virtual void TGraph::RecursiveRemove(TObject* obj) virtual Int_t TGraph::RemovePoint() virtual Int_t TGraph::RemovePoint(Int_t ipoint) virtual void TAttFill::ResetAttFill(Option_t* option = "") virtual void TAttLine::ResetAttLine(Option_t* option = "") virtual void TAttMarker::ResetAttMarker(Option_t* toption = "") void TObject::ResetBit(UInt_t f) virtual void TObject::SaveAs(const char* filename = "", Option_t* option = "") const virtual void TAttFill::SaveFillAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1001) virtual void TAttLine::SaveLineAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1, Int_t widdef = 1) virtual void TAttMarker::SaveMarkerAttributes(ostream& out, const char* name, Int_t coldef = 1, Int_t stydef = 1, Int_t sizdef = 1) virtual void TGraph::SavePrimitive(ostream& out, Option_t* option = "") virtual void TGraph::Set(Int_t n) void TObject::SetBit(UInt_t f) void TObject::SetBit(UInt_t f, Bool_t set) virtual void TObject::SetDrawOption(Option_t* option = "") static void TObject::SetDtorOnly(void* obj) virtual void TGraph::SetEditable(Bool_t editable = kTRUE) virtual void TAttFill::SetFillAttributes() virtual void TAttFill::SetFillColor(Color_t fcolor) virtual void TAttFill::SetFillStyle(Style_t fstyle) void SetFunction(TF1* f) virtual void TGraph::SetHistogram(TH1* h) virtual void TAttLine::SetLineAttributes() virtual void TAttLine::SetLineColor(Color_t lcolor) virtual void TAttLine::SetLineStyle(Style_t lstyle) virtual void TAttLine::SetLineWidth(Width_t lwidth) virtual void TAttMarker::SetMarkerAttributes() virtual void TAttMarker::SetMarkerColor(Color_t tcolor = 1) virtual void TAttMarker::SetMarkerSize(Size_t msize = 1) virtual void TAttMarker::SetMarkerStyle(Style_t mstyle = 1) virtual void TGraph::SetMaximum(Double_t maximum = -1111) virtual void TGraph::SetMinimum(Double_t minimum = -1111) virtual void TNamed::SetName(const char* name) virtual void TNamed::SetNameTitle(const char* name, const char* title) static void TObject::SetObjectStat(Bool_t stat) virtual void TGraph::SetPoint(Int_t i, Double_t x, Double_t y) virtual void TGraph::SetTitle(const char* title = "") virtual void TObject::SetUniqueID(UInt_t uid) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual Int_t TNamed::Sizeof() const void TGraph::Smooth(Int_t npoints, Double_t* x, Double_t* y, Int_t drawtype) virtual void TGraph::Sort(Bool_t (*)(const TGraph*, Int_t, Int_t) greater = &TGraph::CompareX, Bool_t ascending = kTRUE, Int_t low = 0, Int_t high = -1111) virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b) virtual void TObject::SysError(const char* method, const char* msgfmt) const Bool_t TObject::TestBit(UInt_t f) const Int_t TObject::TestBits(UInt_t f) const virtual void TGraph::UseCurrentStyle() virtual void TObject::Warning(const char* method, const char* msgfmt) const virtual Int_t TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) virtual Int_t TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const void TGraph::Zero(Int_t& k, Double_t AZ, Double_t BZ, Double_t E2, Double_t& X, Double_t& Y, Int_t maxiterations)
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 update: root/graf:\$Id: TGraphQQ.h 20882 2007-11-19 11:31:26Z rdm \$