How to predict the value of a model from the best fit parameters?

Initially, I had posted this somewhere else and I noticed it had not reached members. So, I think here is a correct place to post it.
I have learned to model a set of experimental data according to some theory that is known in advance and then find the best parameters that will fit the data based on Xi squared method. Now, I would like to extend the code to a level that it can actually evaluate/predict the “model” at a particular value which is given in terms of (some mean+/-error). Given the best-fit parameters, the code should be able to evaluate the model and then give the result in (mean+/-stdev). I could not find any extension from root website to add to my code. Your help is greatly appreciated. Below is my original code.

#include <math.h>
#include “TFile.h”
#include “TF2.h”
#include “TH1.h”
#include “TH1F.h”
#include “TH2F.h”
#include “TCanvas.h”
#include “TFitResult.h”
#include “TMath.h”
#include “TGraphErrors.h”
#include “TGraph2DErrors.h”
#include “TLegend.h”
#include “TApplication.h”
#include “TFormula.h”
#include “TGraphPolar.h”
#include “TLatex.h”
#include “TMinuit.h”
#include “TProfile.h”
#include “TRandom3.h”
#include “TStyle.h”

void format_line(TAttLine* line,int col,int sty){
line->SetLineWidth(3); line->SetLineColor(col);

double the_model(double* vars, double* pars){
/return pars[0] + pars[1] * std::pow(1 + pars[2] * std::pow(vars[0], pars[3]), -1) ;}/
if (vars[0] < pars[2])
return pars[0] * std::pow((vars[0] / pars[2]), pars[1]);
return pars[0] * std::pow((vars[0] / pars[2]), pars[3]) ;}

int myfit(){

TCanvas* c1=new TCanvas();

TGraphErrors graph_data("./mydata=.txt", “%lg %lg”);
graph_data.SetTitle(“Plot; X; Y”);


gStyle->SetOptTitle(1); gStyle->SetOptStat(0);
gStyle->SetOptFit(1111); gStyle->SetStatBorderSize(0);
gStyle->SetStatX(.89); gStyle->SetStatY(.89);

TF1 model(“model”, the_model,18.0,24.0,4);
double a=1; double b=1; double c=1; double d=1;
format_line(&model, kBlue,1);

model.SetParameter(0, -22.93);
model.SetParameter(1, 1.385);
model.SetParameter(2, 21.06);
model.SetParameter(3, 2.853);

TFitResultPtr frp = graph_data.Fit(&model, “S”);
TMatrixDSym covMatrix (frp->GetCovarianceMatrix());


#ifndef CINT
void StandaloneApplication(int argc, char** argv) {
// eventually, evaluate the application parameters argc, argv
// ==>> here the ROOT macro is called
// This is the standard “main” of C++ starting
// a ROOT application
int main(int argc, char** argv) {
TApplication app(“ROOT Application”, &argc, argv);
StandaloneApplication(app.Argc(), app.Argv());
return 0;


I am not sure exactly what you would like to do. By fitting you are doing parameter estimation, thus estimate the best parameter value on the data given an a priori defined model. It can have both a frequentist meaning or a bayesian one, depending on how you interpret it and on how you have defined your procedure. For example in a Bayesian analysis you can include a prior function describing your model parameters.
But it is not clear to me exactly what you want to do. It is not q question for ROOT but on defining correctly your statistical procedure to analyse your data


Thanks dear Lorenzo,
I see what you are saying. I have to study the procedure I am using and then will be back. I just meant if we happen to find the best model for a set of data. Then how can I evaluate the “model” for some other intermediate data (so it is kind of interpolation within my fitting method). I hope it is clearer now.