Hello,

I am working to get the probability distribution of a conditional statement ( probability of giving birth tomorrow if the mother didn’t give birth yet , the mean and standard deviation are given). I am thinking of modeling it as a gaussian distribution first giving the probability of giving birth as function of time ( in days) .(unconditional statement ). Then, transform the gaussian distribution into a histogram taking the width of the bins dt is 1 day, so the conditional probability we need becomes the area of the bin of the histogram at time t+1 ( probability of giving birth tomorrow) over 1- the integral of the gaussian from zero to t ( which is the error function) [probability of not giving birth till today]

To transform the gaussian into a histogram, I am thinking of taking points with difference 1 between them, getting their probability and plotting the histogram, but is there a better way to do that ? And I would appreciate it if you have a comment on my approach to the problem if it is a good one or there is a flaw.

```
{
const int n_weeks = 66;
TF1 *f = new TF1("f", "[0] * TMath::Gaus(x, [1], [2], 1)", 0., n_weeks * 7.);
f->SetParNames("Constant", "Mean", "Sigma");
f->SetNpx(n_weeks * 7 * 24); // "one per hour"
// f->Print();
// https://en.wikipedia.org/wiki/Gestational_age
f->SetParameters(1., 283.4, 16.); // last menstrual period
// f->SetParameters(1., 280.6, 14.); // second/first-trimester ultrasound
TH1D *h =
new TH1D("EDD",
"Estimated Date of Delivery;Gestational age [day];Probability density [day^{-1}]",
n_weeks * 7, 0., n_weeks * 7.); // one bin per day
h->Sumw2(kFALSE); // just a precaution
h->Eval(f, ""); // "fill" the histogram from the function
h->ResetStats(); // calculate statistics from bin content
TCanvas *c = new TCanvas("c", "EDD");
h->Draw();
f->Draw("same");
gPad->SetGrid(1, 1);
}
```

1 Like