Example macro describing the student t distribution
It draws the pdf, the cdf and then 10 quantiles of the t Student distribution
{
int n=100;
double a=-5.;
double b=5.;
TF1* pdf =
new TF1(
"pdf",
"ROOT::Math::tdistribution_pdf(x,3.0)", a,b);
TF1* cum =
new TF1(
"cum",
"ROOT::Math::tdistribution_cdf(x,3.0)", a,b);
TH1D* quant =
new TH1D(
"quant",
"", 9, 0, 0.9);
for(int i=1; i < 10; i++)
double xx[10];
xx[0] = -1.5;
for(int i=1; i<9; i++)
xx[9] = 1.5;
for(int i=0; i < 9; i++) {
int nbin = n * (xx[i+1]-xx[i])/3.0 + 1.0;
name += i;
pdfq[i]=
new TH1D(name,
"", nbin,xx[i],xx[i+1] );
for(int j=1; j<nbin; j++) {
double x= j*(xx[i+1]-xx[i])/nbin + xx[i];
}
}
TCanvas *Canvas =
new TCanvas(
"DistCanvas",
"Student Distribution graphs", 10, 10, 800, 700);
pdf->
SetTitle(
"Student t distribution function");
cum->
SetTitle(
"Cumulative for Student t");
quant->
SetTitle(
"10-quantiles for Student t");
pdfq[0]->
SetTitle(
"Student t & its quantiles");
pdfq[0]->
SetTitle(
"Student t & its quantiles");
for(int i=0; i < 9; i++) {
}
}
- Author
- Magdalena Slawinska
Definition in file tStudent.C.