Hello, I’m new to RooFit, trying to do various parameter estimation exercises involving minimization via LS (Binned), ML, EML and MM. While for the first two I used the additional parameter L (for likelihood) in the Fit function of TH1D, for the other two I used RooFit. For the EML, I wrote this code
x_roo = RooRealVar("x_roo", "random variable", -1, 1)
alpha_roo = RooRealVar("alpha_roo", "alpha", 0.40, 0.10, 0.70)
beta_roo = RooRealVar("beta_roo", "beta", 0.60, 0.10, 0.70)
scatter_pdf = RooGenericPdf("scatter_pdf", "scatter_pdf", "(1+alpha_roo*x_roo+beta_roo*(x_roo**2))/(2+2*beta_roo/3)", RooArgList(x_roo, alpha_roo, beta_roo))
N_roo = RooRealVar("N_roo", "N_roo", 40000, 60000)
ext_scatter_pdf = RooExtendPdf("ext_scatter_pdf", "extended scatter pdf", scatter_pdf, N_roo)
hist = RooDataHist("data", "data histogram", RooArgList(x_roo), h3)
r = ext_scatter_pdf.fitTo(hist, RooFit.Range("r1"))
xframe = x_roo.frame(RooFit.Title(" "), RooFit.Range(-1.5, 1.5))
hist.plotOn(xframe, RooFit.FillColor(kAzure + 7), RooFit.Binning(50))
ext_scatter_pdf.plotOn(xframe, RooFit.LineColor(kRed + 1), RooFit.LineWidth(5))
c3.cd()
c3.SetTicks()
c3.SetGrid()
xframe.Draw()
c3.Modified()
c3.Update()
c3.SaveAs("test_dist_3.pdf")
For the MM I don’t know how to proceed, or rather, I initialized the various elements, but now I should solve a system of equations of the following type (see image) from which to extract the alpha and beta values.
x_roo = RooRealVar("x_roo", "random variable", -1, 1)
alpha_roo = RooRealVar("alpha_roo", "alpha", 0.40, 0.10, 0.70)
beta_roo = RooRealVar("beta_roo", "beta", 0.60, 0.10, 0.70)
scatter_pdf = RooGenericPdf("scatter_pdf", "scatter_pdf", "(1+alpha_roo*x_roo+beta_roo*(x_roo**2))/(2+2*beta_roo/3)", RooArgList(x_roo, alpha_roo, beta_roo))
integral_1 = RooRealIntegral("integral_1", "integral_1", "x_roo*scatter_pdf")
integral_2 = RooRealIntegral("integral_2", "integral_2", "x_roo*x_roo*scatter_pdf")
How should I move? Thanks for your attention!