One-way frequency table

A submodel of multinomial model/ Allele frequencies of blood groups

This loads the package.

<<StatisticalInference`

A sample of 345 subjects has been classified according to their blood group, obtaining the following frequency table (Azzalini 1996, p. 97). The colums of the table contain values of blood group and counts.

dataFile = ToFileName[
{$InstallationDirectory,
"\\AddOns\\Applications\\StatisticalInference\\Datasets"},
"BloodGroups.dat"];
TableForm[dataOnBloodGroups = Import[dataFile],
     TableAlignments->Right]

bloodGroupCounts = dataOnBloodGroups[[All,2]];
n                = Plus @@ bloodGroupCounts;

Response consists of the blood group counts.

resp =bloodGroupCounts;

Denoting by p and q the allele frequencies of alleles A and B, respectively, and assuming Hardy-Weinberg equilibrium the statistical model for the counts can be defined as a submodel of the multinomial distribution as follows.

𝒟 = MultinomialModel[4,n]

p = .;
ℳ = Submodel[𝒟,{p,q},
       {p^2+2p(1-p-q),q^2+2q(1-p-q),2p q,
        1-(p^2+2p(1-p-q))-(q^2+2q(1-p-q))-2p q}]

The log-likelihood function has the following form.

l = Select[
      LogLikelihoodFunction[ℳ,bloodGroupCounts,{p,q}],
      (!NumericQ[#])&]

This gives the contour plot of the logarithmic likelihood function.

ContourPlot[l,{p,0.01,0.49},{q,0.001,0.49},
            PlotPoints->30,Axes->False,Frame->True];

The maximum likelihood estimates of the allele frequencies are

ℱ=  MLEFit[ℳ, resp, 
        StartingPoint -> {0.2, 0.05}]

MLParameterEstimate[ℱ]

We can calculate a profile likelihood based confidence interval for the allele frequencies.

The (approximate) 95%-level profile likelihood based confidence interval for the frequency of the A allele is

ℐ  =  
      ProfileInterval[ℱ, p, {p, q}]

ConfidenceLimits[ℐ]

The (approximate) 95%-level profile likelihood based confidence interval for the frequency of the B allele is

ℐ  =  
      ProfileInterval[ℱ, q, {p, q}]

ConfidenceLimits[ℐ]

The (approximate) 95%-level profile likelihood based confidence interval for the frequency of the O allele is

ℐ  =  
      ProfileInterval[ℱ, 1 - p - q, {p, q}]

ConfidenceLimits[ℐ]

We can calculate a profile likelihood based confidence interval for the difference of the A and B allele frequencies.

ℐ  =  
      ProfileInterval[ℱ, p - q, {p, q}]

N[ConfidenceLimits[ℐ], 3]

We can test if the allele frequencies of alleles A and B are equal.

𝒯  =  
      LRTest[ℱ, p, {p, p}, 
        StartingPoint -> 0.1]

ObservedSignificanceLevel[𝒯]