How to get correlation matrix for fit?

Hi,

is there a simple way to get the correlation matrix for fit parameters? Something like “GetCovarianceMatrix(Element)” for the covariance matrix or do I have to calculate it “by hand” from the covariance matrix?

Cheers,
Thomas

see: TFitter::GetCovarianceMatrix or TFitter::GetCovarianceMatrixElement or TMinuit::mnemat
root.cern.ch/root/html514/TFitte … anceMatrix
root.cern.ch/root/html514/TFitte … rixElement
root.cern.ch/root/html514/TMinui … uit:mnemat

To get a pointer to the current Fitter, do

Rene

TVirtualFitter *fitter = TVirtualFitter::GetFitter();
TMatrixDSym cov;
cov.Use(fitter->GetNumberTotalParameters(),fitter->GetCovarianceMatrix());

You have now wrapped the pointer to the covariance matrix in a
TMatrixDSym object without copying the actual data .

Accessing the parameter variance vector can now be done through:

TVectorD var = TMatrixDDiag(cov);

Eddy

Hi, is it somehow possible to perform a “correlated” fit? I have to data sets for which I have the covariance matrices and I would need to perform a fit for both measurements considereing these matrices?
Best regards

Hi,
I need to get the covariance matrix in order to calculate the reduced Chi-square for adding bin-by-bin correlations for my histograms. Could you help me with constructing the covariance matrix and inverted covariance matrix which has shown in the following screenshot:

Hi,
This post is unrelated to the subject of the thread. You want the covariance matrix from an histogram or from a sample of data points (not clear to me).
You can look at TH2::GetCovariance or TRobustEstimator
But please open a new thread.

Lorenzo