EB

Basic Statistics

\(\newcommand{\footnotename}{footnote}\) \(\def \LWRfootnote {1}\) \(\newcommand {\footnote }[2][\LWRfootnote ]{{}^{\mathrm {#1}}}\) \(\newcommand {\footnotemark }[1][\LWRfootnote ]{{}^{\mathrm {#1}}}\) \(\let \LWRorighspace \hspace \) \(\renewcommand {\hspace }{\ifstar \LWRorighspace \LWRorighspace }\) \(\newcommand {\TextOrMath }[2]{#2}\) \(\newcommand {\mathnormal }[1]{{#1}}\) \(\newcommand \ensuremath [1]{#1}\) \(\newcommand {\LWRframebox }[2][]{\fbox {#2}} \newcommand {\framebox }[1][]{\LWRframebox } \) \(\newcommand {\setlength }[2]{}\) \(\newcommand {\addtolength }[2]{}\) \(\newcommand {\setcounter }[2]{}\) \(\newcommand {\addtocounter }[2]{}\) \(\newcommand {\arabic }[1]{}\) \(\newcommand {\number }[1]{}\) \(\newcommand {\noalign }[1]{\text {#1}\notag \\}\) \(\newcommand {\cline }[1]{}\) \(\newcommand {\directlua }[1]{\text {(directlua)}}\) \(\newcommand {\luatexdirectlua }[1]{\text {(directlua)}}\) \(\newcommand {\protect }{}\) \(\def \LWRabsorbnumber #1 {}\) \(\def \LWRabsorbquotenumber "#1 {}\) \(\newcommand {\LWRabsorboption }[1][]{}\) \(\newcommand {\LWRabsorbtwooptions }[1][]{\LWRabsorboption }\) \(\def \mathchar {\ifnextchar "\LWRabsorbquotenumber \LWRabsorbnumber }\) \(\def \mathcode #1={\mathchar }\) \(\let \delcode \mathcode \) \(\let \delimiter \mathchar \) \(\def \oe {\unicode {x0153}}\) \(\def \OE {\unicode {x0152}}\) \(\def \ae {\unicode {x00E6}}\) \(\def \AE {\unicode {x00C6}}\) \(\def \aa {\unicode {x00E5}}\) \(\def \AA {\unicode {x00C5}}\) \(\def \o {\unicode {x00F8}}\) \(\def \O {\unicode {x00D8}}\) \(\def \l {\unicode {x0142}}\) \(\def \L {\unicode {x0141}}\) \(\def \ss {\unicode {x00DF}}\) \(\def \SS {\unicode {x1E9E}}\) \(\def \dag {\unicode {x2020}}\) \(\def \ddag {\unicode {x2021}}\) \(\def \P {\unicode {x00B6}}\) \(\def \copyright {\unicode {x00A9}}\) \(\def \pounds {\unicode {x00A3}}\) \(\let \LWRref \ref \) \(\renewcommand {\ref }{\ifstar \LWRref \LWRref }\) \( \newcommand {\multicolumn }[3]{#3}\) \(\require {textcomp}\) \(\newcommand {\intertext }[1]{\text {#1}\notag \\}\) \(\let \Hat \hat \) \(\let \Check \check \) \(\let \Tilde \tilde \) \(\let \Acute \acute \) \(\let \Grave \grave \) \(\let \Dot \dot \) \(\let \Ddot \ddot \) \(\let \Breve \breve \) \(\let \Bar \bar \) \(\let \Vec \vec \) \(\require {mathtools}\) \(\newcommand {\vcentcolon }{\mathrel {\unicode {x2236}}}\) \(\newcommand {\approxcolon }{\approx \vcentcolon }\) \(\newcommand {\Approxcolon }{\approx \dblcolon }\) \(\newcommand {\simcolon }{\sim \vcentcolon }\) \(\newcommand {\Simcolon }{\sim \dblcolon }\) \(\newcommand {\dashcolon }{\mathrel {-}\vcentcolon }\) \(\newcommand {\Dashcolon }{\mathrel {-}\dblcolon }\) \(\newcommand {\colondash }{\vcentcolon \mathrel {-}}\) \(\newcommand {\Colondash }{\dblcolon \mathrel {-}}\) \(\newenvironment {crampedsubarray}[1]{}{}\) \(\newcommand {\smashoperator }[2][]{#2\limits }\) \(\newcommand {\SwapAboveDisplaySkip }{}\) \(\newcommand {\LaTeXunderbrace }[1]{\underbrace {#1}}\) \(\newcommand {\LaTeXoverbrace }[1]{\overbrace {#1}}\) \(\Newextarrow \xLongleftarrow {10,10}{0x21D0}\) \(\Newextarrow \xLongrightarrow {10,10}{0x21D2}\) \(\let \xlongleftarrow \xleftarrow \) \(\let \xlongrightarrow \xrightarrow \) \(\newcommand {\LWRmultlined }[1][]{\begin {multline*}}\) \(\newenvironment {multlined}[1][]{\LWRmultlined }{\end {multline*}}\) \(\let \LWRorigshoveleft \shoveleft \) \(\renewcommand {\shoveleft }[1][]{\LWRorigshoveleft }\) \(\let \LWRorigshoveright \shoveright \) \(\renewcommand {\shoveright }[1][]{\LWRorigshoveright }\) \(\newcommand {\shortintertext }[1]{\text {#1}\notag \\}\) \(\newcommand {\bm }[1]{\boldsymbol {#1}}\) \(\require {cancel}\) \(\require {colortbl}\) \(\let \LWRorigcolumncolor \columncolor \) \(\renewcommand {\columncolor }[2][named]{\LWRorigcolumncolor [#1]{#2}\LWRabsorbtwooptions }\) \(\let \LWRorigrowcolor \rowcolor \) \(\renewcommand {\rowcolor }[2][named]{\LWRorigrowcolor [#1]{#2}\LWRabsorbtwooptions }\) \(\let \LWRorigcellcolor \cellcolor \) \(\renewcommand {\cellcolor }[2][named]{\LWRorigcellcolor [#1]{#2}\LWRabsorbtwooptions }\) \(\newcommand {\tcbset }[1]{}\) \(\newcommand {\tcbsetforeverylayer }[1]{}\) \(\newcommand {\tcbox }[2][]{\boxed {\text {#2}}}\) \(\newcommand {\tcboxfit }[2][]{\boxed {#2}}\) \(\newcommand {\tcblower }{}\) \(\newcommand {\tcbline }{}\) \(\newcommand {\tcbtitle }{}\) \(\newcommand {\tcbsubtitle [2][]{\mathrm {#2}}}\) \(\newcommand {\tcboxmath }[2][]{\boxed {#2}}\) \(\newcommand {\tcbhighmath }[2][]{\boxed {#2}}\)

12.2 Solutions

  • 12.2.1 The application of a hypothesis test for paired data is justified by the fact that the samples of both varieties were obtained in the same location, considering several locations for the study as a whole. Thus, \(n = 10\) blocks (locations) were formed, composed of a set of two experimental units with high uniformity among themselves. To each pair of sampling units in each location, both varieties were randomized.

    The hypotheses of interest and alternative are given by

    \begin{align*} H_0:&\,\,\mu _D\le 10 & \textrm { versus } && H_1:&\,\,\mu _D>10. \end{align*}

    The adequate statistic to test this hypothesis is given by

    \begin{align*} T_c =& \dfrac {\bar {D}-\mu _0}{\dfrac {S_D}{\sqrt {n}}}\\ =&\dfrac {15.13-10}{ \dfrac {4.9004}{\sqrt {10}}}\\ =&3.3105, \end{align*} associated with \(\nu \) \(=\) \(10-1\) \(=\) \(9\) degrees of freedom.

    The \(p\)-value for the one-sided hypothesis is \(P(T >\) 3.3105;\(\nu =9)\) \(=\) 0.0045. Thus, there is significant evidence at \(5\%\) that the hypothesis that variety B produces on average \(10\) t/ha or less than variety A. Therefore, variety B is more productive than variety A by an amount that exceeds \(10\) t/ha. The \(95\%\) confidence interval one-sided to the right (alternative hypothesis “greater than”) is \([\)15.13, \(\infty )\). Thus, the lower limit for the difference can be more precisely obtained with the result of this interval, complementing the result of the test.

    Complementing the answer to the question asked in the exercise, which we answered at the beginning, we can make an analogy of the \(t\) test for paired samples with the analysis of variance in a randomized complete block design. If we consider two treatments (the varieties) and the locations (sampling units) as blocks, the \(F\) test is equivalent to the \(t\) test we presented. The value of the \(F\) statistic is the square of the value of the \(t\) statistic and the \(p\)-value is the same in both cases, leading to the same conclusion.

  • 12.2.2 Let us consider the \(t\) test for the normal case, but also the nonparametric tests. Let us consider that the agreement between the laboratories refers to the homogeneity of their means or their medians. Thus, we will apply three tests, which are detailed below.

    • a) Test for the equality of means assuming bivariate normality of the joint distribution of the laboratories or normality of the difference:

      The hypotheses of interest and alternative are given by

      \begin{align*} H_0:&\,\,\mu _D\le 0 & \textrm { versus } && H_1:&\,\,\mu _D> 0. \end{align*}

      The adequate statistic to test this hypothesis is given by

      \begin{align*} T_c =& \dfrac {\bar {D}-\mu _0}{\dfrac {S_D}{\sqrt {n}}}\\ =&\dfrac {-13.27273}{ \dfrac {20.46016}{\sqrt {11}}}\\ =&-2.15153, \end{align*} associated with \(\nu \) \(=\) \(11-1\) \(=\) \(10\) degrees of freedom.

      The \(p\)-value for the bilateral hypothesis is \(2P(T >\)2.15153;\(\nu =10)\) \(=\) 0.0569. Thus, there is no significant evidence at \(5\%\) to reject the hypothesis of homogeneity of the laboratories.

    • b) Exact sign test

      The null hypothesis of homogeneity between the laboratories and the alternative hypothesis are given by

      \begin{align*} H_0:&\,\,\mu _D\ge 0 & \textrm { versus } && H_1:&\,\,\mu _D < 0. \end{align*}

      In this case, \(\mu _0\) \(=\) \(0\) and the differences were obtained by \(D_j\) \(=\) \(X_{2j}-X_{1j}-\mu _0\) \(=\) \(X_{2j}-X_{1j}\), for \(j=1\), \(2\), \(\cdots \), \(n\). Since no difference was equal to zero, the effective sample size \(n_t\) was equal to \(11\). The value of \(n^+\) is \(4\) and of \(n^-\) is \(7\). The value of \(S\) is \(s\) \(=\) \(n^+\) \(=\) \(4\).

      If \(H_0\) is true, then \(E(S)\) \(=\) 5.5 is expected. The \(p\)-value can, exactly, be obtained alternatively by the \(F\) distribution. The value of the statistic is

      \begin{align*} F_c =& \dfrac {s+1}{n_t-s}\\ =&\dfrac {4+1}{11-4}=\dfrac {5}{7}\\ =&0.7142857, \end{align*} with \(\nu _1\) \(=\) \(2(n_t-s)\) \(=\) \(2\times (11-4)\) \(=\) \(14\) and \(\nu _2\) \(=\) \(2(s+1)\) \(=\) \(2(4+1)\) \(=\) \(10\) degrees of freedom. The \(p\)-value is

      \begin{align*} \textrm {$p$-value} =& P(S\le 4)=2P(F\le 0.7142857;\nu _1=14,\nu _2=10)\\ =&0.5488, \end{align*} obtained with the R program with the command 2*pf(0.7142857,14,10). Thus, the null hypothesis of homogeneity between laboratories should not be rejected, for the nominal significance level of \(5\%\).

    • c) Wilcoxon signed rank test

      The null and alternative hypotheses are

      \begin{align*} H_0:&\,\,\mu _D\ge 0 & \textrm { versus } && H_1:&\,\,\mu _D < 0. \end{align*}

      The differences obtained are presented below.

      .
      Sampling units
      Differences 1 2 3 4 5 6 7 8 9 10 11
      \(D_j\) \(-\)12 \(-\)10 \(-\)42 \(-\)15 1 \(-\)11 4 \(-\)60 2 \(-\)10 7

      Eliminating the signs, sorting these differences in absolute value, assigning ranks and returning the corresponding signs, we have the following results.

      .
      Order
      Quantities 1 2 3 4 5 6 7 8 9 10 11
      \(|D_j|\) \(-\)12 \(-\)10 \(-\)42 \(-\)15 1 \(-\)11 4 \(-\)60 2 \(-\)10 7
      Ranks 8.0 5.5 10 9 1 7 3 11 2 5.5 4
      Signs \(-\) \(-\) \(-\) \(-\) \(+\) \(-\) \(+\) \(-\) \(+\) \(-\) \(+\)

      Ties occurred and \(n_t\) \(=\) \(n\) \(=\) \(11\). The value of the statistic \(T^+\), in this case, is equal to the sum of the positive ranks, which is equal to \(10\). Thus, \(T^+\) \(=\) \(10\) and \(T^-\) \(=\) \(56\). To calculate the variance, it is necessary to apply the correction for ties. In this case, there were \(g\) \(=\) \(1\) group of ties with \(t_1\) \(=\) \(2\) ties. Thus,

      \begin{align*} \mu _{T^+} =& \dfrac {n_t(n_t+1)}{4}\\ =&\dfrac {11\times (11+1)}{4}\\ =&33 \end{align*} and

      \begin{align*} V_{T^+} =& \dfrac {n_t(n_t+1)(2n_t+1)-0.5\sum _{j=1}^g \left (t_j^3 -t_j\right )}{24}\\ =&\dfrac {11\times 12\times 23-0.5\times (2^3 - 2)}{24} \\ =& 126.375. \end{align*}

      The value of the statistic \(T_c\) is

      \begin{align*} T_c=& \dfrac {T^+-\mu _{T^+}}{\sqrt {\dfrac {n_t V_{T^+} - \left (T^+-\mu _{T^+} \right )^2}{n_t-1}}}\\ =& \dfrac {10-33}{\sqrt {\dfrac {11\times 126.375 - \left (10-33\right )^2}{11-1}}}\\ =& \dfrac {-23}{\sqrt {86.1125}}\\ =& -2.4785, \end{align*} with \(\nu \) \(=\) \(10\) degrees of freedom.

      The \(p\)-value is

      \begin{align*} \textrm {$p$-value} =& 2\times P(T\ge 2.4785;\nu =10)=0.0326. \end{align*}

      Thus, the null hypothesis of homogeneity of the laboratories must be rejected at the nominal significance level of \(5\%\). Thus, the commercial laboratory has a lower median value than the state laboratory. This result is different from the previous ones. This only demonstrates that the signed rank test, in non-normal situations, is much more powerful than the competing tests.

  • 12.2.3 Let us apply the \(t\) test and the LRT with and without Bartlett correction. The null and alternative hypotheses are

    \begin{align*} H_0: &\,\, \sigma ^2_1 =\sigma ^2_2=\sigma ^2 &\textrm { versus }&& H_1: &\,\, \sigma ^2_1 \ne \sigma ^2_2. \end{align*}

    The unbiased estimates of the variances and covariance necessary for the application of the tests are

    \begin{align*} S^2_1 =& 1014.0727, &&& S^2_2=&363.7636, &&& S_{12}=& 479.6091, \end{align*} besides

    \begin{align*} r_1=& \dfrac {S_{12}}{\sqrt {S^2_1S^2_2}}=\dfrac {479.6091}{\sqrt {1014.0727\times 363.7636}}=0.7897. \end{align*}

    The maximum likelihood estimates, divisor \(n\), are

    \begin{align*} \hat {\sigma }^2_1 =& 921.8843, &&& \hat {\sigma }^2_2=&330.6942, &&& \hat {\sigma }_{12}=& 436.0083, \end{align*}

    \begin{align*} \hat {\sigma }^2=& \dfrac {\hat {\sigma }^2_1+\hat {\sigma }^2_2}{2}\\ =& \dfrac {921.8843+ 330.6942}{2}\\ =& 626.2893 \end{align*} and

    \begin{align*} \hat {\rho }=& \dfrac {\hat {\sigma }_{12}}{\hat {\sigma }^2} =\dfrac {436.0083}{626.2893}\\ =& 0.6962. \end{align*}

    • i) Student’s \(t\) test

      To apply this test, it is necessary to calculate the value of \(F\) by

      \begin{align*} F =& \dfrac {S^2_1}{S^2_2}=\dfrac {1014.0727}{363.7636}\\ =& 2.7877. \end{align*}

      Then, since \(r_1\) was already obtained previously, the value of the statistic should be calculated by

      \begin{align*} T_c =& \dfrac {(F-1)\sqrt {n-2}}{2\sqrt {F(1-r_1^2)}} \\ =& \dfrac {(2.7877-1)\times \sqrt {11-2}}{2\times \sqrt {2.7877\times (1-0.7897^2)}} \\ =& 2.6177. \end{align*}

      The \(p\)-value is obtained from the Student’s \(t\) distribution with \(\nu \) \(=\) \(n - 2\) \(=\) \(11 - 2\) \(=\) \(9\) degrees of freedom, by

      \begin{align*} \textrm {$p$-value} =& 2P(T\ge 2.6177;\nu =9)=0.0279. \end{align*}

      Since the \(p\)-value is less than \(5\%\), it is concluded that there is significant evidence to reject the hypothesis of equality of variances of suspended solids (SS) of the two laboratories considered. It is possible to state that the SS variability of the commercial laboratory is greater than that of the state laboratory.

    • ii) LRT without correction

      It is easy to see that the estimator \(\hat {\rho }_{12}\) is equivalent to the estimator \(r_1\), since the divisors \(n-1\) and \(n\) do not interfere in the estimate obtained. Thus, the LRT test statistic is given by

      \begin{align*} \chi ^2_c =& n\left [2\ln \left (\hat {\sigma }^2\right )+ \ln \left (1 - \hat {\rho }^2 \right ) - \sum _{i=1}^{2} \ln \left (\hat {\sigma }^2_i\right ) - \ln \left (1-\hat {\rho }^2_{12}\right ) \right ]\\ =& 11\times \bigg [2\times \ln (626.2893)+ \ln (1-0.6962^2) - \\ & \qquad - \ln (921.8843)-\ln (330.6942)-\ln (1-0.7897^2)\bigg ]\\ =& 6.2272. \end{align*}

      The \(p\)-value to test the hypothesis is given by the chi-square distribution with \(\nu \) \(=\) \(1\). The test can also be done by comparing the calculated value with the critical value \(\chi ^2_{0.05;\nu =1}\) \(=\) \(3.84\). The \(p\)-value is given by

      \begin{align*} \textrm {$p$-value} =& P(\chi ^2\ge 6.2272;\nu =1)=0.0126. \end{align*}

      Since both the \(p\)-value is less than \(5\%\) and the calculated value of 6.23 is greater than the critical value of \(3.84\), the null hypothesis must be rejected. Note that the \(p\)-value of this approximation is much lower than the \(p\)-value of the \(t\) test, which under the bivariate normal model is exact.

    • iii) LRT with Bartlett correction

      To apply this test, it is necessary to calculate the Bartlett correction and multiply the result by the chi-square value obtained previously. The correction is given by

      \begin{align*} C =& \left [1-(2k+11)/(6n)\right ]\\ =& [1-(2\times 2+11)/(6\times 11)]\\ =& 0.7727273. \end{align*}

      Thus, the chi-square value is

      \begin{align*} \chi ^2_c =& n\left [1-(2k+11)/(6n)\right ] \left [2\ln \left (\hat {\sigma }^2\right )+ \ln \left (1 - \hat {\rho }^2 \right ) - \sum _{i=1}^{2} \ln \left (\hat {\sigma }^2_i\right ) - \ln \left (1-\hat {\rho }^2_{12}\right ) \right ]\\ =& 0.7727273\times 6.2272\\ =& 4.8119. \end{align*}

      The \(p\)-value to test the hypothesis is given by the chi-square distribution with \(\nu = 1\) by

      \begin{align*} \textrm {$p$-value} =& P(\chi ^2\ge 4.8119;\nu =1)=0.0283. \end{align*}

      In this case, the same conclusion as before was reached that there is significant evidence at \(5\%\) to reject the null hypothesis that the two laboratories do not agree on the variability of the analyses provided and that the variability of the commercial laboratory is greater than that of the state laboratory. The extreme agreement of the \(p\)-values presented by this last alternative and by the Student’s \(t\) is noted, as already emphasized in the discussion of the results of the Monte Carlo simulations carried out in the Book.

  • 12.2.4 The hypotheses of interest are given by

    \begin{align*} H_0:&\,\,p_{12}\ge p_{21} & \textrm { versus } && H_1:&\,\,p_{12}< p_{21}. \end{align*}

    • i) Sign test

      In this case, since \((b + c)/2\) \(=\) \(42\), being greater than \(10\), therefore, all tests can be applied. For this, \(b\) \(=\) \(n^+\) \(=\) \(24\), \(c\) \(=\) \(n^-\) \(=\) \(60\) and \(n_t\) \(=\) \(84\). Thus, since \(s\) \(=\) \(n^+\) \(=\) \(24\), the exact one-sided sign test is

      \begin{align*} \textrm {$p$-value}=& P(S\le s) =P(S\le 24)=\left (\dfrac {1}{2}\right )^{n_t} \displaystyle \sum _{j=0}^{s} \binom {n_t}{j} \\ =& \left (\dfrac {1}{2}\right )^{84} \displaystyle \sum _{j=0}^{24} \binom {84}{j}=\dfrac {1}{2^{84}}\left [\binom {84}{0}+ \binom {84}{1}+ \cdots + \binom {84}{24}\right ]\\ =& 5.357384\times 10^{-5} \end{align*}

      Therefore, there is significant evidence at \(5\%\) to reject the null hypothesis that the campaign was not efficient in the preference of the producers. That is, there was a significant differentiation in the migration of preference between the two cultivars. The alternatives for obtaining the \(p\)-value using the exact relationship of the binomial with the \(F\) and the normal approximation with and without continuity correction were exemplified below.

      The exact \(p\)-value can be obtained by the relationship of the binomial with the \(F\), initially calculating the value of the statistic

      \begin{align*} F_c=& \dfrac {s+1}{n_t-s}\dfrac {1-p}{p}= \dfrac {24+1}{84-24}\dfrac {1-0.5}{0.5} = \dfrac {5}{12}=0.41667, \end{align*} with \(\nu _1\) \(=\) \(2(n_t-s)\) \(=\) \(120\) and \(\nu _2\) \(=\) \(2(s + 1)\) \(=\) \(50\) degrees of freedom. The \(p\)-value is

      \begin{align*} \textrm {$p$-value}=& P(S\le s)=P(F\le 0.41667;\nu _1=120,\nu _2=50)=5.357384\times 10^{-5}. \end{align*}

      The normal approximation can also be applied. The value \(Z_c\) without continuity correction is

      \begin{align*} Z_c =& \dfrac {2s-n_t}{\sqrt {n_t}}=\dfrac {48-84}{\sqrt {84}}=-3.927922. \end{align*}

      The \(p\)-value is given by

      \begin{align*} \textrm {$p$-value}\approx & P(Z\le -3.927922)=4.284149\times 10^{-5}. \end{align*}

      Using the continuity correction, we obtain

      \begin{align*} Z_c =& \dfrac {2(s+0.5)-n_t}{\sqrt {n_t}}=\dfrac {49-84}{\sqrt {84}}=-3.818813, \end{align*} the \(p\)-value being given by

      \begin{align*} \textrm {$p$-value} \approx & P(Z\le -3.818813)=6.704766\times 10^{-5}. \end{align*}

    • ii) McNemar test

      To apply this one-sided test, it is advisable to use the normal test equivalent to the chi-square test, when there are two levels. Thus,

      \begin{align*} Z_c =& \dfrac {b-c}{\sqrt {b+c}} = \dfrac {24-60}{\sqrt {84}}=-3.927922, \end{align*} which is essentially the sign test, since \(2s-n_t\) \(=\) \(b-c\) and \(n_t\) is equal to \(b+c\).

      The \(p\)-value is exactly the same as that of the sign test without continuity correction (\(4.284149\times 10^{-5}\)). This occurs because the McNemar test and the normal approximation of the sign test are equivalent. It can be observed, as stated previously, that

      \begin{align*} Z_c =& \dfrac {2s-n_t}{\sqrt {n_t}} = \dfrac {2b-(b+c)}{\sqrt {b+c}} = \dfrac {b-c}{\sqrt {b+c}}. \end{align*}

      All alternatives led to the same result and it was concluded that there is significant evidence at \(5\%\) to state that the marketing resulted in a significant change in producer preference for cultivar A.