SJLPHI
May 27, 2016, 6:48pm
#1
Hello,

I’m starting to question what the definition of RMS is in ROOT.
It seems, to really calculated the
"RMS" = <x^2>= (X1^2 + X2^2 +…)/N , mean of squares,
instead of the Mathematical/Statistical definition of
RMS= sqrt(<x^2>), Root of mean of squares.

I haven’t been able to successfully find the definition in the documentation. Could someone point me in the right direction please?

See, for example, the TH1::GetRMS and the TH1::GetStdDev method descriptions.

SJLPHI
May 27, 2016, 8:53pm
#3
If I am not mistaken, the Standard Deviation from ROOT TMath returns Variation value, without the square-root still.

according to these lines:

```
stddev2 = TMath::Abs(stats[axm+1]/stats[0] -x*x);
7057 if (axis<10)
7058 return TMath::Sqrt(stddev2);
7059 else {
7060 // The right formula for StdDev error depends on 4th momentum (see Kendall-Stuart Vol 1 pag 243)
7061 // formula valid for only gaussian distribution ( 4-th momentum = 3 * sigma^4 )
7062 Double_t neff = GetEffectiveEntries();
7063 return ( neff > 0 ? TMath::Sqrt(stddev2/(2*neff) ) : 0. );
```

at here: root.cern.ch/doc/master/TH1_8cx … tml#l07047

the square-root should be performed, but the value seems to be exactly the square of standard deviation I am able to calculate.

Pseudo code logic:
while (load data){
sum+=value
sumsq+=valuevalue}
average=sum/num_data
variance= (sumsq -sum sum)/numb_data - average*average
stdev=sqrt(variance)

this stdev seems to be different from both RMS, or StDev that TH1D returns. I should state that I am using ROOT 5.34.36