5.06b, 5.06c - Fitting a theoretical distribution

5.06b, 5.06c - Fitting a theoretical distribution

Turn a proposed probability model into the frequencies it predicts for a sample. Given ratios and discrete uniform models provide the starting point in 5.06b; 5.06c extends the same idea to binomial, geometric, Poisson and continuous distributions, including a distribution specified by its density.

Given proportions and discrete uniform models

Can a model predict 31.47831.478 waiting times in a group when the observed number must be a whole number? Yes: an expected frequency is an average prediction, not an instruction to find a fraction of an observation. By the end, you will obtain such counts directly from continuous probabilities.

You already know

A probability distribution assigns total probability 11. A binomial variable counts successes in a fixed number of independent equal-probability trials; a geometric variable counts trials up to and including the first success. Expected frequencies and observed frequencies have different jobs.

Imagine repeating a sample of size NN many times under a fixed model. If an observation has probability pip_i of landing in class ii, the long-run average count in that class is NpiNp_i. This is the bridge from any distribution to a frequency table.

Expected frequency from a model

For NN independent observations with class probabilities pip_i,

Ei=Npi,∑ipi=1,∑iEi=NE_i=Np_i,\qquad \sum_i p_i=1,\qquad \sum_i E_i=N

The classes must be mutually exclusive and cover the model's entire possible range.
Not in the formula booklet: learn it.

A proposed ratio provides probabilities after dividing each weight by the sum of all weights. It need not match the observed proportions: matching the model to its own hypothesis is the point.

Worked example 1: a specified ratio

Question. A model claims that three categories occur in the ratio 2:3:52:3:5. Find their expected frequencies in 8080 observations.

Plan. Normalise the ratio, then multiply the probabilities by 8080.

2+3+5=10total weight(p1,p2,p3)=(2/10,3/10,5/10)convert weights to probabilities(E1,E2,E3)=80(2/10,3/10,5/10)multiply by sample size=(16,24,40)evaluate\begin{aligned} 2+3+5&=10 &&\text{total weight}\\ (p_1,p_2,p_3)&=(2/10,3/10,5/10) &&\text{convert weights to probabilities}\\ (E_1,E_2,E_3)&=80(2/10,3/10,5/10) &&\text{multiply by sample size}\\ &=(16,24,40) &&\text{evaluate} \end{aligned}

Why this step? A ratio weight is not itself a probability: the probabilities must sum to 11.

Answer. The expected frequencies are 16,24,4016,24,40.

Check. They sum to 8080 and retain the ratio 2:3:52:3:5.

Worked example 2 changes the proposed weights to equal weights. This is the discrete uniform case; equal probabilities are a model assumption, not a consequence of having named categories.

Worked example 2: a discrete uniform hypothesis

Question. A model assigns equal probabilities to the five values 1,2,3,4,51,2,3,4,5. Find the expected frequencies in 8080 observations.

Plan. Give each of the five possible values probability 1/51/5.

pr=15(r=1,2,3,4,5)discrete uniform modelEr=80×15=16same probability for each value\begin{aligned} p_r&=\frac15\quad(r=1,2,3,4,5) &&\text{discrete uniform model}\\ E_r&=80\times\frac15=16 &&\text{same probability for each value} \end{aligned}

Why this step? There are five possible values, not four intervals between the endpoints.

Answer. The expected table is (16,16,16,16,16)(16,16,16,16,16).

Check. 5×16=805\times16=80; each expectation is at least 55.

The discrete uniform probability 1/n1/n for nn equally likely values is printed in the formula booklet. Its use to produce counts still requires multiplying by the sample size.

Watch out

Wrong: use observed proportions Oi/NO_i/N as the hypothesis probabilities. That gives Ei=OiE_i=O_i by construction and makes every discrepancy zero. Use the proposed model, estimating only parameters the question requires.

A fit is a prediction from the stated model; whether the data support that prediction is the next lesson's question.

Fitting binomial models

A binomial model predicts one expected frequency for each possible success count, using the trial count and success probability.

Recall P(X=r)=(nr)pr(1−p)n−r\mathrm{P}(X=r)=\binom nr p^r(1-p)^{n-r} for X∼B(n,p)X\sim\mathrm{B}(n,p); this probability and E(X)=np\mathrm{E}(X)=np are in the formula booklet. Here nn is the number of trials in one observation, whereas NN is the number of observed groups. Confusing them changes the entire model.

If pp is specified independently of the data, retain it. If the question asks you to fit an unspecified binomial probability with known nn, match the model mean npnp to the sample mean xˉ\bar x.

Fitted binomial probability

For NN observed success counts from groups of nn trials, estimate an unknown pp by

p^=xˉn=∑rrOrnN\widehat p=\frac{\bar x}{n}=\frac{\sum_r rO_r}{nN}

Then use B(n,p^)\mathrm{B}(n,\widehat p) to calculate expected frequencies. This assumes the binomial model is appropriate.
Not in the formula booklet: learn it.

Record that a parameter was estimated: it will matter when counting degrees of freedom for a goodness of fit test.

Worked example 3: a specified success probability

Question. For each of 8080 independent groups of three trials, the model is X∼B(3,1/2)X\sim\mathrm{B}(3,1/2). Find the expected frequencies for X=0,1,2,3X=0,1,2,3.

Plan. Calculate the four binomial probabilities, then multiply each by 8080.

P(X=r)=(3r)(1/2)3given model(p0,p1,p2,p3)=18(1,3,3,1)binomial coefficients(E0,E1,E2,E3)=80×18(1,3,3,1)convert probabilities to counts=(10,30,30,10)evaluate\begin{aligned} \mathrm{P}(X=r)&=\binom3r(1/2)^3 &&\text{given model}\\ (p_0,p_1,p_2,p_3)&=\frac18(1,3,3,1) &&\text{binomial coefficients}\\ (E_0,E_1,E_2,E_3)&=80\times\frac18(1,3,3,1) &&\text{convert probabilities to counts}\\ &=(10,30,30,10) &&\text{evaluate} \end{aligned}

Why this step? The sample size is 8080, while the binomial trial count is 33: they enter different parts of the calculation.

Answer. 10,30,30,1010,30,30,10.

Check. They sum to 8080 and are symmetric because p=1/2p=1/2.

Worked example 4 changes only whether the success probability is known. The sample now supplies its estimate, even though it happens to produce the same fitted probability.

Worked example 4: estimate the success probability

Question. In 8080 groups of three trials, the observed frequencies for 0,1,2,30,1,2,3 successes are 9,33,27,119,33,27,11. Fit a binomial distribution with unknown success probability and find the expected frequencies.

Plan. Count all observed successes, estimate pp, then use the fitted binomial distribution.

∑rrOr=0(9)+1(33)+2(27)+3(11)=120total successesp^=1203×80=12successes divided by trialsEr=80(3r)(1/2)3fit the model(E0,E1,E2,E3)=(10,30,30,10)evaluate\begin{aligned} \sum_r rO_r&=0(9)+1(33)+2(27)+3(11)=120 &&\text{total successes}\\ \widehat p&=\frac{120}{3\times80}=\frac12 &&\text{successes divided by trials}\\ E_r&=80\binom3r(1/2)^3 &&\text{fit the model}\\ (E_0,E_1,E_2,E_3)&=(10,30,30,10) &&\text{evaluate} \end{aligned}

Why this step? The observed mean estimates the model's mean; no individual frequency is forced to match its observed count.

Answer. The fitted model is B(3,1/2)\mathrm{B}(3,1/2), giving 10,30,30,1010,30,30,10. One model parameter was estimated from these data.

Check. The fitted expected total number of successes is 1(30)+2(30)+3(10)=1201(30)+2(30)+3(10)=120, matching the observed total.

The numerical fit does not establish independence of the trials or a constant success probability. Those remain modelling assumptions to check in context.

Watch out

Wrong: p^=xˉ\widehat p=\bar x for a binomial success count. Right: p^=xˉ/n\widehat p=\bar x/n. Also, grouped data with an open-ended class do not reveal its exact success total; do not invent class values to estimate pp.

Use exact totals when they are available, and keep the fitted probability unrounded while finding expectations.

Fitting geometric models and tails

A geometric model has infinitely many possible trial counts, so a finite frequency table must include the remaining tail.

Recall that OCR's geometric variable counts the successful trial: its support is 1,2,3,…1,2,3,\ldots. For X∼Geo(p)X\sim\mathrm{Geo}(p), the booklet gives P(X=r)=(1−p)r−1p\mathrm{P}(X=r)=(1-p)^{r-1}p, P(X>r)=(1−p)r\mathrm{P}(X>r)=(1-p)^r and E(X)=1/p\mathrm{E}(X)=1/p. There is no zero class with positive probability.

For an unspecified pp, match 1/p1/p to the observed mean. The resulting fitting rule p^=1/xˉ=N/∑rOr\widehat p=1/\bar x=N/\sum rO_r is not printed in the formula booklet. If the exact total is unavailable because the tail is grouped, use any mean or parameter supplied; do not replace “44 or more” by exactly 44.

Worked example 5: retain the infinite tail

Question. Fit the given model X∼Geo(1/2)X\sim\mathrm{Geo}(1/2) to 8080 observations in the classes 1,2,3,≥41,2,3,\ge4.

Plan. Calculate the first three point probabilities and use a tail probability for the final class.

(p1,p2,p3)=(1/2,1/4,1/8)point probabilitiesP(X≥4)=P(X>3)=(1/2)3=1/8all remaining trials(E1,E2,E3,E≥4)=80(1/2,1/4,1/8,1/8)multiply by 80=(40,20,10,10)evaluate\begin{aligned} (p_1,p_2,p_3)&=(1/2,1/4,1/8) &&\text{point probabilities}\\ \mathrm{P}(X\ge4)&=\mathrm{P}(X>3)=(1/2)^3=1/8 &&\text{all remaining trials}\\ (E_1,E_2,E_3,E_{\ge4})&=80(1/2,1/4,1/8,1/8) &&\text{multiply by }80\\ &=(40,20,10,10) &&\text{evaluate} \end{aligned}

Why this step? The final class includes 4,5,6,…4,5,6,\ldots, rather than just the event X=4X=4.

Answer. 40,20,10,1040,20,10,10.

Check. The probabilities sum to 11, and the expected frequencies sum to 8080.

Worked example 6 changes only the source of the parameter: an observed total supplies it instead of a fixed hypothesis value.

Worked example 6: estimate a geometric parameter

Question. The exact sum of 8080 observed trial counts is 200200. Fit a geometric model and calculate expectations for 1,2,3,≥41,2,3,\ge4.

Plan. Estimate pp from the sample mean, then retain the entire tail.

xˉ=200/80=2.5sample meanp^=1/2.5=0.4match the model mean(p1,p2,p3,p≥4)=(0.4,0.6(0.4),0.62(0.4),0.63)geometric probabilities(E1,E2,E3,E≥4)=(32,19.2,11.52,17.28)multiply by 80\begin{aligned} \bar x&=200/80=2.5 &&\text{sample mean}\\ \widehat p&=1/2.5=0.4 &&\text{match the model mean}\\ (p_1,p_2,p_3,p_{\ge4})&=(0.4,0.6(0.4),0.6^2(0.4),0.6^3) &&\text{geometric probabilities}\\ (E_1,E_2,E_3,E_{\ge4})&=(32,19.2,11.52,17.28) &&\text{multiply by }80 \end{aligned}

Why this step? Lower success probability produces a longer average wait; using p=xˉp=\bar x would not even give a valid probability.

Answer. The fitted model is Geo(0.4)\mathrm{Geo}(0.4), with expectations 32,19.2,11.52,17.2832,19.2,11.52,17.28. One parameter was estimated.

Check. The expectations sum to 8080, and the fitted mean is 1/0.4=2.51/0.4=2.5.

An observed zero trial count would be impossible under this convention. That is a support mismatch, not a small discrepancy to hide by combining the zero class with another one.

Watch out

Wrong: P(X≥4)=0.64\mathrm{P}(X\ge4)=0.6^4 when p=0.4p=0.4. Right: the first three trials must fail, so P(X≥4)=0.63\mathrm{P}(X\ge4)=0.6^3; trial 44 is allowed to be the success.

Write the final class as a probability event before using a calculator.

Fitting Poisson models

A Poisson fit uses its mean count for the actual observation interval, then converts count probabilities into expected frequencies.

Recall P(X=r)=e−mmr/r!\mathrm{P}(X=r)=e^{-m}m^r/r! and E(X)=m\mathrm{E}(X)=m for X∼Po(m)X\sim\mathrm{Po}(m); both are in the formula booklet. To fit an unspecified mm, set m^=xˉ\widehat m=\bar x. This estimation rule is not printed in the booklet. Use an exact count total or a supplied mean, rather than inventing values in an open tail class.

Continue this lesson.

You’re previewing NovaLearn without an account. Create a free account to read the rest.

Create free account