Meaning/Significance of RMS

I know that the rms value in the Statistics box stands for the root mean square, and I know the formula for rms. But, I am not sure what it means when the Statistics box displays RMSx and RMSy. Does it represent the rms for each bin in x,y? I also read that in ROOT, the RMS actually is the standard deviation Is this true? Any explanation would be greatly appreciated. Thanks.

What do you find missing at: ?

for dimensions >= 1 RMSx is the standard deviation along X
for dimensions >= 2 RMSy is the standard deviation along Y
for dimensions >=3 RMSz is the standard deviation along Z


Yes, it is. See, for example.


Thanks for the explanation.

In general the rms and the std is not the same.
The rms is commonly used as an estimator for the std because its often the
only readily availalable quantity (it can be easily calculated from the data).

The rms is an unbiased estimator of the std
If the underlying distribution is gaussian and systematic errors such as ADC quantization errors are small compared too the signal amplitude, but
it can lead too terribly wrong results if these two requiremnts are not satisfied.

This is probably not a big deal for most ROOT users, who probably deal with large samples, but wouldn’t it be more wise to use (n-1) instead of n in the standard deviation computation ?

I am reluctant to change this, since these formula (using biased estimator for the standard deviation) have been used since a long time.
Also I remind you that the biased estimator for the standard deviation that we use in ROOT (TMath::RMS, TH1::GetRMS, tc…) is more efficient, i.e. it is having a smaller MSE (Mean squared error) compared to the unbiased one. We could then debate what is the better estimator…


The original post was asking a question if MSE on \sigma, i.e. “\sigma_\sigma” is properly evaluated in ROOT assuming Gaussian statistics. I removed the post to avoid future confusion, because the answer is “yes”, \sigma_\sigma = \sigma/\sqrt{2 N}, where \sigma = \sqrt(\hat{Var(x)}) as R. Barlow’s book explains very clearly on p.79 (this is for the biased estimator of Var(x), for the unbiased one it would be \sigma/\sqrt{2 (N-1)}).

What if I want to calculate RMS (no standard deviation), do I have to do it on my own?



Yes if you want root mean square of an Histogram and not the standard deviation you need to compute yourself.
It is a trivial operation from the standard deviation and the mean

double rootMeanSquare = std::sqrt ( h1->GetMean()*h1->GetMean() + h1->GetRMS()*h1->GetRMS() );


Hi there,

In this regard, it would make life much easier not to have to warn any new colleagues (not only statisticians or signal processing engineers but also biologists or any other scientists…)

So how about

[ul][] Adding a function allowing to change the “RMS label” displayed [/]
Changes to be made to TStyle.h

TString fStatRMSlabel ; void SetStatRMSlabel(const char* label="RMS") {fStatRMSlabel = label;} const char* GetStatRMSlabel() const {return fStatRMSlabel.Data();} Changes to be made to THistPainter::THistPainter()

gStringRMS = gEnv->GetValue("Hist.Stats.RMS", gStyle->GetStatRMSlabel()); gStringRMSX = gEnv->GetValue("Hist.Stats.RMSX", TString::Format("%s x",gStyle->GetStatRMSlabel()).Data()); gStringRMSY = gEnv->GetValue("Hist.Stats.RMSY", TString::Format("%s y",gStyle->GetStatRMSlabel()).Data()); gStringRMSZ = gEnv->GetValue("Hist.Stats.RMSZ", TString::Format("%s z",gStyle->GetStatRMSlabel()).Data()); Usage (rootlogon)gStyle->SetStatRMSlabel("Std Dev") ;
[ul][] Creating “redirect” functions for coders e.g. [/]

Double_t TH1::GetStdDev(Int_t axis) const
   return ( GetRMS(axis) ) ;
Double_t TH1::GetStdDevError(Int_t axis) const
   return ( GetRMSError(axis) ) ;


[quote]gStringRMS = gEnv->GetValue(“Hist.Stats.RMS”, gStyle->GetStatRMSlabel());
gStringRMSX = gEnv->GetValue(“Hist.Stats.RMSX”, TString::Format("%s x",gStyle->GetStatRMSlabel()).Data());
gStringRMSY = gEnv->GetValue(“Hist.Stats.RMSY”, TString::Format("%s y",gStyle->GetStatRMSlabel()).Data());
gStringRMSZ = gEnv->GetValue(“Hist.Stats.RMSZ”, TString::Format("%s z",gStyle->GetStatRMSlabel()).Data());[/quote]Rubbish! :blush:
Please check rmslabel.tgz (svn diff against trunk revision 47030)

[quote]Double_t TH1::GetStdDev(Int_t axis) const { return ( GetRMS(axis) ) ; }
Double_t TH1::GetStdDevError(Int_t axis) const { return ( GetRMSError(axis) ) ; }[/quote]Clumsy and incomplete!
Please check stddevfunctions.tgz (svn diff against trunk revision 47030)

Would it be possible to commit these changes to the trunk?

stddevfunctions.tgz (698 Bytes)
rmslabel.tgz (1019 Bytes)

Any restrictions?

Knock, knock…
Another try (diff against current trunk (rev. 6e3d420f7cf1f95c5ee1c2a7ee204b4f3a228f52))
for the visual part only (rmslabel.tgz)

Usage: gStyle->SetStatRMSlabel("Std Dev") ;
Could someone please commit this ultra light transparent feature to the trunk?
THistPainter.cxx.diff (1.26 KB)
TStyle.h.diff (1.63 KB)

sorry I missed that… let me see.

I think you are reinventing the wheel … simply set the string you need in $ROOTSYS/etc/system.rootrc

# Default statistics parameters names.
Hist.Stats.Entries:   Entries
Hist.Stats.Mean:      Mean
Hist.Stats.MeanX:     Mean x
Hist.Stats.MeanY:     Mean y
Hist.Stats.MeanZ:     Mean z
Hist.Stats.RMS:       RMS
Hist.Stats.RMSX:      RMS x
Hist.Stats.RMSY:      RMS y
Hist.Stats.RMSZ:      RMS z
Hist.Stats.Underflow: Underflow
Hist.Stats.Overflow:  Overflow
Hist.Stats.Integral:  Integral
Hist.Stats.Skewness:  Skewness
Hist.Stats.SkewnessX: Skewness x
Hist.Stats.SkewnessY: Skewness y
Hist.Stats.SkewnessZ: Skewness z
Hist.Stats.Kurtosis:  Kurtosis
Hist.Stats.KurtosisX: Kurtosis x
Hist.Stats.KurtosisY: Kurtosis y
Hist.Stats.KurtosisZ: Kurtosis z

This was my first attempt indeed :wink:
But as I remember it, it was not a viable solution since at that time this file got overwritten each time I was recompiling Root (this is no more the case fortunately :slight_smile:)
On a general basis I don’t think one should need to fiddle with config files any time (s)he wants to install a new version of Root. According to me this is what the rootlogon.C is for.
More importantly

  • the choice of the label must be left to the end user which is not possible if several persons use the same Root build (what if two users want to set different names at the same time?)
  • you may just not have the right to modify this file
    So I guess the best solution is to use a TStyle method.

By the way I forgot a file last time… :frowning:
Attached’s the full patch :smiley:

THistPainter.cxx.diff (1.24 KB)
TStyle.cxx.diff (1.51 KB)
TStyle.h.diff (1.68 KB)


For consistency, here’s the patch (git diff against trunk rev 15e65321c9a587ccda95e3847097040ff4b79dfd) that takes into account all stat labels:

gStyle->SetStatLabelEntries () ; gStyle->SetStatLabelMean () ; gStyle->SetStatLabelRMS ("Stdev") ; gStyle->SetStatLabelUnderflow() ; gStyle->SetStatLabelOverflow () ; gStyle->SetStatLabelIntegral () ; gStyle->SetStatLabelSkewness () ; gStyle->SetStatLabelKurtosis () ;
It cancels and replaces the previous one.
(Note the rootname has changed: xStatRMSLabel() -> xStatLabelRMS())

THistPainter.cxx.3.diff (3.45 KB)
TStyle.cxx.3.diff (2.89 KB)
TStyle.h.3.diff (3.63 KB)

I do not think we can have an other way of changing these labels.
We will stick with the technique we have now.
There is no other examples of parameters you can set in two ways like that …
It would be rather confusing. Plus … which one will have the priority ???

Here’s the point I missed so far: … t-start-up
namely, any user can override the file $ROOTSYS/etc/system.rootrc (which may be locked) by creating its own personal config file and calling it “.rootrc”.
Pb solved! :wink: