Basic Statistics
11.2 Solutions
-
11.2.1 The longevity means of the two species were compared by confidence interval. However, the Shapiro-Wilk normality test within each species and the variance homogeneity test were applied before. The results of all procedures are described below.
-
a) For T. nerudai the results of the Shapiro-Wilk test were: statistic \(W\) \(=\) 0.8958428 and \(p\)-value \(=\) 0.3065471. For the species T. dendrolimi the results were: \(W\) \(=\) 0.8987753 and \(p\)-value \(=\) 0.3236299. Since both values were higher than the nominal significance level of 0.05, we should not reject the null hypothesis of normality. Thus, this assumption, for us to use the estimation methods based on normality, was met.
-
b) The results of the tests of this chapter are summarized in the following table:
Method Statistic \(p\)-value LRT \(\chi ^2_c=\)0.1627 0.6867 F test \(F_C=\)1.4101 0.6871 LRT corr. kurtosis \(\chi ^2_c=\)0.3594 0.5488 LRT corr. kurtosis 2 \(\chi ^2_c=\)0.3894 0.5326 BF \(F_C=\)0.0312 0.8628 Traditional Levene \(F_C=\)0.1866 0.6735 Levene squared deviation \(F_C=\)0.3964 0.5408 Layard \(F_C=\)0.4303 0.5242 O’Brien \(F_C=\)0.2753 0.6094 All results, of all tests, lead to non-rejection of the null hypothesis of homogeneity of variances. It is convenient to clarify here that in real life we choose only one of these tests and present its results. Since there are two populations and the null hypothesis of normality was not rejected, then it would suffice to apply the \(F\) test in this case. If there were rejection of normality, we could choose any of the last \(5\) options, which are Levene-type tests. These tests are robust to violation of normality. Here the objective is for the reader to train in the application of these tests. The details of the calculations were left to the reader for this training. The assumption of homogeneity of variances was also met and the interval estimation of homoscedastic normal populations can be applied.
-
c) Since there is normality of the samples and the variances are homogeneous, then the normal interval can be used. The detailed results are presented below.
The interval of \(\gamma \) \(=\) \(1-\alpha \) confidence for the difference of means \(\mu _1-\mu _2\) between two normal populations with common variance \(\sigma ^2\) is given by
\(\seteqnumber{0}{11.}{0}\)\begin{align*} CI_{1-\alpha }(\mu _1-\mu _2):& \bar {X}_1 -\bar {X}_2 \pm e = \bar {X}_1 -\bar {X}_2 \pm t_{\alpha /2;\nu }\sqrt {S^2_p \left (\dfrac {1}{n_1}+\dfrac {1}{n_2}\right )}, \end{align*} where \(t_{\alpha /2;\nu }\) is the upper quantile of the Student’s \(t\) distribution with \(\nu \) \(=\) \(n_1 + n_2 - 2\) degrees of freedom. The following results in days were obtained.
Items Trichogramma nerudai Trichogramma dendrolimi Mean 2.7471 1.7014 Variance 0.4532 0.3214 Sample size 7 7 The pooled variance is
\(\seteqnumber{0}{11.}{0}\)\begin{align*} S^2_p =& \dfrac {(n_1-1)S_1^2 + (n_2-1)S_2^2}{n_1+n_2-2}= \dfrac {6\times 0.4532 + 6\times 0.3214}{7+7-2}=0.3873. \end{align*} The upper \(2.5\%\) quantile of the Student’s \(t\) distribution with \(\nu \) \(=\) \(12\) degrees of freedom is \(t_{0.025;\nu =12}\) \(=\) 2.1788. The confidence interval is
\(\seteqnumber{0}{11.}{0}\)\begin{align*} CI_{1-\alpha }(\mu _1-\mu _2):&\,\,\, \bar {X}_1 -\bar {X}_2 \pm t_{\alpha /2;\nu }\sqrt {S^2_p \left (\dfrac {1}{n_1}+\dfrac {1}{n_2}\right )} \\ & = 2.7471-1.7014 \pm 2.1788\sqrt {0.3873\left (\dfrac {1}{7}+\dfrac {1}{7}\right )}\\ &= 1.0457\pm 0.7248\\ & =[0.3209,\,\, 1.7705]. \end{align*} Thus, the true difference \(\mu _1-\mu _2\), unknown, between the means of the species Trichogramma nerudai \(\mu _1\) and of the species Trichogramma dendrolimi \(\mu _2\) is a value that should be between 0.3209 day and 1.7705 day with \(95\)% confidence. Therefore, it is possible to infer that the species Trichogramma nerudai has a mean lifetime greater than the mean lifetime of the species Trichogramma dendrolimi, by an amount, with \(95\%\) confidence, that should be within this interval.
-
-
11.2.2 In this example we have two variables, arterial glucose and blood flow. We divided into two parts considering each variable.
-
a) For glucose:
The descriptive statistics of both populations (\(1\) for the control and \(2\) for the treated) are presented below.
Population Descr. Stat. \((i)\) \(S^2_i\) \(\hat {\sigma }^2_i\) \(\bar {X}_{i.}\) \(n_{i}\) 1 0.85 0.7650 3.21 10 2 0.80 0.7429 3.11 14 The maximum likelihood pooled variance and the unbiased estimator are
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \hat {\sigma }^2 =& \dfrac {\displaystyle \sum _{i=1}^{k} n_i \hat {\sigma }_i^2}{n}= \dfrac {10\times 0.7650+14\times 0.7429}{24}\\ =& 0.7521 \end{align*} and
\(\seteqnumber{0}{11.}{0}\)\begin{align*} S^2_p =& \dfrac {\displaystyle \sum _{i=1}^{k} (n_i-1) S_i^2}{n-k}= \dfrac {9\times 0.85+13\times 0.80}{24-2}=0.8205. \end{align*}
-
i) LRT test:
The test statistic is
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \chi ^2_c =& 24\times \ln (0.7521) - \left [10\times \ln (0.7650)+14\times \ln (0.7429)\right ]\\ =& 0.0025, \end{align*} associated with \(\nu \) \(=\) \(k - 1\) \(=\) \(1\) degree of freedom.
The \(p\)-value is given by
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \textrm {$p$-value} =& P(\chi ^2\ge 0.0025;\nu =1)=0.9600. \end{align*}
Equivalently, consulting Table A.3 with \(\alpha \) \(=\) \(5\%\) and \(\nu \) \(=\) \(1\) degree of freedom, we have the upper chi-square \(5\%\) quantile, which is equal to 3.841. Thus, since the calculated value of 0.0025 is less than the critical value of 3.841 (tabulated value) or the \(p\)-value is greater than the nominal value of \(5\%\), \(H_0\) should not be rejected at this nominal significance level. The variances can be considered homogeneous and the choice in example 11.1 (of the Book) was correct.
-
ii) Bartlett test (LRT with correction of Bartlett (1937))
The test statistic is
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \chi ^2_c =& \dfrac {1}{1+\dfrac {1}{3(2-1)}\times \left [\dfrac {1}{10} + \dfrac {1}{14}-\dfrac {1}{24-2}\right ]} \\ &\times \left [(24-2)\times \ln (0.8205)- 10\times \ln (0.85)-14\times \ln (0.80)\right ]\\ =& 0.0094, \end{align*} associated with \(\nu \) \(=\) \(1\) degree of freedom.
The \(p\)-value is given by
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \textrm {$p$-value} =& P(\chi ^2\ge 0.0094;\nu =1)=0.9229. \end{align*}
As in the previous case, the null hypothesis \(H_0\) should not be rejected considering the nominal significance value of \(5\%\), since the \(p\)-value is greater than 0.05 or the calculated chi-square value of 0.0094 is less than the tabulated value of 3.841.
-
iii) \(F\) test
The value of the statistic, \(F_c\), is given by
\(\seteqnumber{0}{11.}{0}\)\begin{align*} F_c=& \dfrac {S^2_1}{S^2_2}=\dfrac {0.85}{0.80}=1.0625, \end{align*} associated with \(\nu _1 = 9\) degrees of freedom of the variance of the numerator of the expression (population \(1\)) and \(\nu _2 = 13\) degrees of freedom associated with the denominator of the expression (population \(2\)). Thus, we have
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \textrm {$p$-value} =& 2\min (P(F_{\nu _1=9,\nu _2=13}\le 1.0625),1-P(F_{\nu _1=9,\nu _2=13}\le 1.0625))\\ =& 2\times \min (0.5535,0.4465)\\ =&0.8931. \end{align*}
Consulting Table A.6, of the upper quantiles of the \(F\) distribution, we have \(F_{0.025;\nu _1=9,\nu _2=13}\) \(=\) 3.31 and \(F_{0.975;\nu _1=9,\nu _2=13}\) \(=\) 0.26. Since the calculated value of \(F\) of 1.0625 is between the two tabulated values, or equivalently, the \(p\)-value is greater than the nominal value of \(5\%\), it is concluded that there is no significant evidence to reject the null hypothesis of equality of population variances. All three tests had the same result, in terms of the decision made. In relation to example 11.1 (of the Book), where the variances were considered homogeneous, the decision, based on the present tests, was correct.
-
-
b) For blood flow:
The descriptive statistics of both populations (\(1\) for the control and \(2\) for the treated) are presented below.
Population Descr. Stat. \((i)\) \(S^2_i\) \(\hat {\sigma }^2_i\) \(\bar {X}_{i.}\) \(n_{i}\) 1 4 3.6000 94 10 2 36 33.4286 120 14 The maximum likelihood pooled variance and the unbiased estimator are
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \hat {\sigma }^2 =& \dfrac {\displaystyle \sum _{i=1}^{k} n_i \hat {\sigma }_i^2}{n}= \dfrac {10\times 3.6000+14\times 33.4286}{24}\\ =& 21 \end{align*} and
\(\seteqnumber{0}{11.}{0}\)\begin{align*} S^2_p =& \dfrac {\displaystyle \sum _{i=1}^{k} (n_i-1) S_i^2}{n-k}= \dfrac {9\times 4+13\times 36}{24-2}\\ =& 22.9091. \end{align*}
-
i) LRT test:
The test statistic is
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \chi ^2_c =& 24\times \ln (21) - \left [10\times \ln (3.6000)+14\times \ln (33.4286)\right ]\\ =& 11.1275, \end{align*} associated with \(\nu \) \(=\) \(k - 1\) \(=\) \(1\) degree of freedom.
The \(p\)-value is given by
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \textrm {$p$-value} =& P(\chi ^2\ge 11.1275;\nu =1)=0.0009. \end{align*}
Consulting Table A.3 with \(\alpha \) \(=\) \(5\%\) and \(\nu \) \(=\) \(1\) degree of freedom, we have the upper chi-square \(5\%\) quantile, which is equal to 3.841. Thus, since the calculated value of 11.1275 is greater than the critical value of 3.841 (tabulated value) or the \(p\)-value is less than the nominal value of \(5\%\), \(H_0\) must be rejected at this nominal significance level. The variances must be considered heterogeneous and the decision in example 11.1 (of the Book) was correct.
-
ii) Bartlett test (LRT with correction of Bartlett (1937))
The test statistic is
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \chi ^2_c =& \dfrac {1}{1+\dfrac {1}{3(2-1)}\times \left [\dfrac {1}{10} + \dfrac {1}{14}-\dfrac {1}{24-2}\right ]} \\ &\times \left [(24-2)\times \ln (22.9091)- 10\times \ln (4)-14\times \ln (36)\right ]\\ =& 9.3853, \end{align*} associated with \(\nu \) \(=\) \(1\) degree of freedom.
The \(p\)-value is given by
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \textrm {$p$-value} =& P(\chi ^2\ge 9.3853;\nu =1)=0.0022. \end{align*}
As in the previous case, the null hypothesis \(H_0\) must be rejected considering the nominal significance value of \(5\%\), since the \(p\)-value is less than 0.05 or the calculated chi-square value of 9.3853 is greater than the tabulated value of 3.841.
-
iii) \(F\) test
The value of the statistic, \(F_c\), is given by
\(\seteqnumber{0}{11.}{0}\)\begin{align*} F_c=& \dfrac {S^2_1}{S^2_2}=\dfrac {4}{36}=0.1111, \end{align*} associated with \(\nu _1 = 9\) degrees of freedom of the variance of the numerator of the expression (population \(1\)) and \(\nu _2 = 13\) degrees of freedom associated with the denominator of the expression (population \(2\)). Thus, we have
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \textrm {$p$-value} =& 2\min (P(F_{\nu _1=9,\nu _2=13}\le 0.1111),1-P(F_{\nu _1=9,\nu _2=13}\le 0.1111))\\ =& 2\times \min (0.0012,0.9988)\\ =&0.0024. \end{align*}
Consulting Table A.6, of the upper quantiles of the \(F\) distribution, we have \(F_{0.025;\nu _1=9,\nu _2=13}\) \(=\) 3.31 and \(F_{0.975;\nu _1=9,\nu _2=13}\) \(=\) 0.26. Since the calculated value of \(F\) of 0.1111 is less than the lower limit (0.26), which determines the critical region, or equivalently, the \(p\)-value is less than the nominal value of \(5\%\), it is concluded that there is significant evidence to reject the null hypothesis of equality of population variances. All three tests had the same result, in terms of the decision made. In relation to example 11.1 (of the Book), where the variances were considered heterogeneous, the decision, based on the present tests, was correct.
-
-
-
11.2.3 The data to be analyzed are:
Groups Sample 256 209 0 0 0 44 49 117 6 0 \(G_1\) 0 75 34 13 0 90 0 32 0 205 332 0 31 0 0 89 0 0 0 163 286 3 843 0 \(G_2\) 158 443 311 232 179 179 19 142 100 0 432 These data are from the dry biomass content of Coleoptera (in mg) in the stomachs of two classes of horned lizards (Phrynosoma douglassi brevirostre). The lizards were classified by size. The first class is adult males and young females (\(G_1\)) with \(n_1 = 24\) and the second is adult females (\(G_2\)) with \(n_2 = 21\). The main descriptive statistics are presented below.
Groups Adult males and young females Adult females Statistics (\(G_1\)) (\(G_2\)) Sample size 24 21 Mean 62.2083 170.4286 Variance 8,855.9112 43,498.4570 The Shapiro-Wilk test for each sample, in both groups, led to rejection of the normality hypothesis. The Brown and Forsythe (1974) test also led to rejection of the homogeneity of variances hypothesis (results not shown). Thus, robust or nonparametric methods should be used. In the example, we will use the method of Guo & Luh (2000). We will consider \(\beta = 10\%\), to obtain the trimmed and Winsorized means.
For the first sample, with \(\beta = 10\%\), we have
\(\seteqnumber{0}{11.}{0}\)\begin{align*} m_1 =& \lfloor 24\times 0.10\rfloor = 2 &\textrm { and } && f_1 =& 24-2 \times 2= 20. \end{align*}
Thus,
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \bar {X}_{1,A}=& \dfrac {1}{f_1}\sum _{j=m_1+1}^{n_1-m_1} X_{1(j)}=\dfrac {X_{1(3)}+X_{1(4)}+\cdots +X_{1(22)}}{20}=42.25. \end{align*}
The Winsorized mean is
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \bar {X}_{1,W}=& \dfrac {1}{n_1}\sum _{j=1}^{n_1} Z_{1(j)}\\ =&\dfrac {X_{1(3)}+X_{1(3)}+X_{1(3)}+X_{1,(4)}+ \cdots +X_{1(22)}+X_{1(22)}+X_{1(22)}}{24}\\ =&55.1250. \end{align*}
The Winsorized variance is \(S^2_{1,W}\) \(=\) 7117.611842 and, finally, \(\hat {\mu }_{1,W}\) \(=\) 633899.7984375.
For the second sample, the following results were obtained
\(\seteqnumber{0}{11.}{0}\)\begin{align*} m_2 =& \lfloor 21\times 0.10\rfloor = 2 &\textrm { and } && f_2 =& 21-2 \times 2= 17. \end{align*}
Therefore,
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \bar {X}_{2,A} =& 134.882353, &&& \bar {X}_{2,W}=& 150.333333,\\ S^2_{2,W}=& 29480.041666 &\textrm { and } && \hat {\mu }_{2,W}=& 2827653.385621. \end{align*}
Thus, the other quantities are
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \hat {\sigma }_{W}^2 =& 2090.00069, &&& \hat {\mu }_{W}=& 11369.017266,\\ \hat {\gamma } =& 0.118988032 &\textrm { and } && \nu =& 22.4449. \end{align*}
Thus,
\(\seteqnumber{0}{11.}{0}\)\begin{align*} t_{0.025;\nu =22.4449} &=2.07149 &\textrm { and } && \beta _{0.025;\nu =22.4449}=& 1.90422. \end{align*}
Finally, the confidence interval is given by
\(\seteqnumber{0}{11.}{0}\)\begin{align*} CI_{0.95}(\mu _1-\mu _2): \,& \left [-176.69, \,\, -2.57\right ]. \end{align*}
Therefore, it can be stated, with \(95\%\) confidence, that the two populations have different means. It can be inferred with \(95\%\) confidence that the mean Coleoptera content in mg of the class of adult males and young females is less than that of the class of adult females by an amount that should be between 2.57 mg and 176.69 mg. The interval obtained by the permutation method is [-201.7927, -9.2657] and by bootstrap is [-205.0380, -8.2043]. Thus, despite differences between the limits of these intensive computing methods and those obtained here, essentially the conclusions of significant differences between the two groups are the same.
-
11.2.4 The experimental results are presented below.
Groups Sample 155.76 282.00 197.34 297.00 115.50 126.72 119.46 29.04 Normal 349.14 109.90 143.22 64.02 25.54 85.80 122.10 454.85 252.78 122.10 655.38 13.88 82.50 99.66 97.66 150.48 242.88 67.98 227.70 130.68 Diabetic 19.80 100.32 71.94 133.32 464.64 36.96 46.20 34.32 73.26 17.82 43.56 The main descriptive statistics are presented below.
Groups Statistics Normal Diabetic Sample size 20 19 Mean 186.076 112.720 Variance 25,256.850 11,200.160 Skewness 1.629 2.301 Kurtosis 2.949 6.376 The confidence interval of Guo & Luh (2000) with \(\beta =10\%\) is
\(\seteqnumber{0}{11.}{0}\)\begin{align*} CI_{0.95}(\mu _1-\mu _2): \,& \left [-5.8755, \,\, 132.1582\right ]. \end{align*}
The confidence interval using the permutation and bootstrap methods can only be solved computationally. For this reason, we made an R program to help us in this task. The program with the necessary data to run this example is presented below.
# bootstrap and permutation CI for two independent samples # Function to obtain permutation and bootstrap t # confidence interval for the difference of two # independent sample means. op= "boot" or "perm" # alpha <- 0.05 ciBootPermMeanDiff <- function(x,y,B=1000, op="boot",alpha = 0.05) { n1 <- length(x) n2 <- length(y) n <- n1 + n2 xy <- c(x,y) xb <- mean(x) yb <- mean(y) s2x <- var(x) s2y <- var(y) tk <- function(xbyb, n1, n2) { xbb <- xbyb[1:n1] ybb <- xbyb[(n1+1):(n1+n2)] mxb <- mean(xbb) myb <- mean(ybb) vxb <- var(xbb) vyb <- var(ybb) t <- (mxb - myb) / sqrt(vxb/n1 + vyb/n2) return(t) } if (op == "boot") { res <- function(xy,n1,n2) { return(c(sample(xy, n1, replace = TRUE), sample(xy, n2, replace = TRUE))) } } else if (op == "perm") { res <- function(xy,n1,n2) { res1 <- sample(1:(n1+n2), n1, replace = FALSE) res2 <- c(xy[-res1],xy[res1]) return(res2) } } t <- matrix(rep(xy, each=B),B,n1+n2) t <- t(apply(t,1,res,n1,n2))# resamples t <- apply(t, 1, tk, n1, n2) ttab <- quantile(t, c(alpha/2, 1-alpha/2)) lower <- xb-yb + ttab[1]*sqrt(s2x/n1+s2y/n2) upper <- xb-yb + ttab[2]*sqrt(s2x/n1+s2y/n2) return(list(lower=lower,upper=upper, ttab=ttab,op=op)) } # Example 11.2 from the book x1 <- c(155.76, 282.00, 197.34, 297.00, 115.50, 126.72, 119.46, 29.04, 349.14, 109.90, 143.22, 64.02, 25.54, 85.80, 122.10, 454.85, 252.78, 122.10, 655.38, 13.88) x2 <- c(82.50, 99.66, 97.66, 150.48, 242.88, 67.98, 227.70, 130.68, 19.80, 100.32, 71.94, 133.32, 464.64, 36.96, 46.20, 34.32, 73.26, 17.82, 43.56) ciBootPermMeanDiff(x1,x2,B=25000,op="boot",alpha = 0.05) ciBootPermMeanDiff(x1,x2,B=25000,op="perm",alpha = 0.05)The result of both procedures were obtained using \(25000\) resamplings (without and with replacement). The \(95\%\) confidence interval for the intensive permutation method is
\(\seteqnumber{0}{11.}{0}\)\begin{align*} CI_{0.95}(\mu _1-\mu _2): \,& \left [-10.8802, \,\, 159.1098\right ] \end{align*} and the bootstrap one is
\(\seteqnumber{0}{11.}{0}\)\begin{align*} CI_{0.95}(\mu _1-\mu _2): \,& \left [-11.8355, \,\, 160.2370\right ]. \end{align*}
Thus, the results of the three procedures agree with each other, indicating that there are no significant differences between the normal and diabetic groups regarding the nitrogen fixation of the albumen, since the \(95\%\) intervals contain the value \(0\).
-
11.2.5 The means of the zinc contents of two treatments (A and B) were compared by a hypothesis test for normal populations, as stated in the exercise. However, the Shapiro-Wilk normality test within each sample of each treatment and the homogeneity of variances test were applied before. The results of the normality test confirmed what had been mentioned in the statement itself, that is, both samples were considered as coming from normal populations. The homogeneity of variances test presented \(F_c\) \(=\) 2.046 and \(p\)-value of 0.3012. Thus, there is no evidence to reject the hypothesis of homogeneity of variances at the nominal significance level of 5%.
The sample estimates are presented below.
Species \(n_i\) \(\bar {X}_i\) \(S^2_i\) A 10 265.09 6475.4721 B 10 255.98 3165.0062 The hypothesis of interest is
\(\seteqnumber{0}{11.}{0}\)\begin{align*} H_0:\mu _1-\mu _2=&0 & \textrm { versus } && H_1:\mu _1-\mu _2\ne &0. \end{align*}
Thus, since the variances are considered homogeneous, the common variance \(S^2_p\) should be obtained, since it is a better estimator of the common population variance \(\sigma ^2\), being given by
\(\seteqnumber{0}{11.}{0}\)\begin{align*} S^2_p=& \dfrac {(n_1-1)S_1^2 + (n_2-1)S_2^2}{n_1+n_2-2}=\dfrac {9\times 6475.4721+ 9\times 3165.0062}{10+10-2}\\ =&4820.2392. \end{align*}
The calculated value of the statistic \(T_c\) is
\(\seteqnumber{0}{11.}{0}\)\begin{align*} t_c =& \dfrac {\bar {X}_1-\bar {X}_2-(\mu _{10}-\mu _{20})}{\sqrt {S^2_p \left (\frac {1}{n_1}+ \frac {1}{n_2} \right )}}=\dfrac {265.09-255.98}{4820.2392\left ( \dfrac {1}{10} + \dfrac {1}{10}\right )}\\ =&0.2934. \end{align*}
The critical value \(t_{\alpha /2;\nu }\) \(=\) \(t_{0.025;\nu =18}\) with \(\nu \) \(=\) \(18\) degrees of freedom is equal to 2.1009. Thus, since \(t_c\) \(=\) 0.2934 is between \(-2.1009\) and 2.1009, the null hypothesis \(H_0\) should not be rejected at the nominal level of \(5\%\) significance, inferring that treatments A and B do not differ regarding the mean zinc content of the tibiae of broiler chickens. Alternatively, the computed \(p\)-value was 0.7726, reinforcing the conclusion reached. The R program made to facilitate the application of this test and others that the user may be interested in is presented below with the present example as illustration.
# Test for two independent normal samples # alternative: "two.sided", "less" or "greater twoIndNormSamples.Test <- function(X, alpha = 0.05, mud0=0, alternative="two.sided") { if (is.data.frame(X) == FALSE) Y <- as.data.frame(X) else Y <- X colnames(Y) <- c("group", "res") Y$group <- as.factor(Y$group) ni <- tapply(Y$res, Y$group, length) k <- length(ni) if (k != 2) stop("Number of samples must be 2!") n <- sum(ni) s2i <- tapply(Y$res, Y$group, var) xbi <- tapply(Y$res, Y$group, mean) fc <- s2i[1] / s2i[2] p.value <- pf(fc, ni[1]-1,ni[2]-1) p.value <- 2 * min(p.value,1-p.value) if (p.value > alpha) #homogeneity variances { hom = TRUE s2p <- sum((ni-1) * s2i)/ (n - k) nu <- n - 2 tc <- (xbi[1] - xbi[2] - mud0) / sqrt(s2p*(1/ni[1]+1/ni[2])) if (alternative == "two.sided") p.value <- 2 * (1 - pt(abs(tc), nu)) else p.value <- pt(tc, nu, lower.tail = (alternative == "less")) } else #heterogeneity variances { hom = FALSE nu <- (sum(s2i/ni))^2/sum((s2i/ni)^2/(ni-1)) tc <- (xbi[1]-xbi[2]-mud0)/sqrt(sum(s2i/ni)) if (alternative == "two.sided") p.value <- 2 * (1 - pt(abs(tc), nu)) else p.value <- pt(tc, nu, lower.tail = (alternative == "less")) } return(list(tc = tc, p.value = p.value, nu = nu, homog=hom, alternative=alternative)) } # Example: exercise 11.5.5 x <- c(253.8,152.2,298.1,356.5,98.2,282.3,329.6,271.3,288.4,320.5) y<-c(284.5,376.0,183.4,304.7,231.5,263.5,257.7,208.6,244.9,205.0) X <- c(rep(c(1),times=length(x)), rep(c(2),times=length(y)), x,y) n <- length(x) + length(y) X <- matrix(X, n, 2) twoIndNormSamples.Test(X,alpha=0.05,mud0=0,alternative="two.sided") -
11.2.6 The results of each procedure are detailed below. In all cases the hypotheses of interest, null and alternative, are:
\(\seteqnumber{0}{11.}{0}\)\begin{align*} H_0:\mu _1-\mu _2=&0 & \textrm { versus } && H_1:\mu _1-\mu _2\ne &0. \end{align*}
-
a) Let us start with the test of Guo & Luh (2000) considering \(\beta =10\%\):
For the first sample we have
\(\seteqnumber{0}{11.}{0}\)\begin{align*} m_1 =& \lfloor 10\times 0.10\rfloor = 1 &\textrm { and } && f_1 =& 10-2 \times 1=8. \end{align*}
Thus,
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \bar {X}_{1,A}=& \dfrac {1}{f_1}\sum _{j=m_1+1}^{n_1-m_1} X_{1(j)}\\ =&\dfrac {X_{1(2)}+X_{1(2)}+\cdots +X_{1(9)}}{8}\\ =&9.25. \end{align*}
The main descriptive statistics are presented below.
Regions Statistics A B Sample size 10 7 Mean 8.900 19.286 Variance 23.656 16.905 The Winsorized mean is
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \bar {X}_{1,W}=& \dfrac {1}{n_1}\sum _{j=1}^{n_1} Z_{1(j)}\\ =&\dfrac {X_{1(2)}+X_{1(2)}+X_{1(3)}+X_{1,(4)}+ \cdots +X_{1(10)}+X_{1(10)}}{10}\\ =&8.80. \end{align*}
The Winsorized variance is \(S^2_{1,W}\) \(=\) 25.0857 and, finally, \(\hat {\mu }_{1,W}\) \(=\) \(-\)94.32.
For the second sample, the following results were obtained
\(\seteqnumber{0}{11.}{0}\)\begin{align*} m_2 =& \lfloor 7\times 0.10\rfloor = 0 &\textrm { and } && f_2 =& 7-2 \times 0=7. \end{align*}
Therefore,
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \bar {X}_{2,A} =& 19.2857, &&& \bar {X}_{2,W}=& 20,\\ S^2_{2,W} =& 21.6667 &\textrm { and } && \hat {\mu }_{2,W}=& -30. \end{align*}
Thus, the other quantities are
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \hat {\sigma }_{W}^2 =& 6.2310, &&& \hat {\mu }_{W}=& -2.0860,\\ \hat {\gamma } =& -0.1341 &\textrm { and } && \nu =& 12.9355. \end{align*}
Finally, we have
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \hat {\Gamma } =& \dfrac {\left (\bar {X}_{1,A}-\bar {X}_{2,A}\right )- \left (\mu _{10}-\mu _{20} \right )}{\hat {\sigma }_W}\\ =&\dfrac {9.25-19.2857-0}{\sqrt {6.2310}}\\ =& -4.0204. \end{align*}
Thus,
\(\seteqnumber{0}{11.}{0}\)\begin{align*} t_{HW} =& \hat {\Gamma } + \dfrac {\hat {\gamma }}{6} + \dfrac {\hat {\gamma }\hat {\Gamma }^2}{3} + \dfrac {\hat {\gamma }^2\hat {\Gamma }^3}{27}\\ =& -4.8087. \end{align*}
Since the tabulated \(t\) value is \(t_{0.025;\nu =12.9355}\) \(=\) 2.1615 with \(\nu \) \(=\) 12.9355 degrees of freedom, then \(H_0\) must be rejected, considering a nominal value of \(5\%\) significance, since the calculated value in absolute value is greater than the tabulated value. The \(p\)-value obtained was 0.00035, which ratifies this conclusion. Thus, region A has a lower mean number of nests per hectare than region B.
-
b) The second test is the bootstrap with \(B=25000\) resamplings. For this, we used the program previously presented. The result led to a value of the statistic \(t_c\) \(=\) \(-\)4.75, whose \(p\)-value is 0.00024. Thus, again it is concluded that region A has a lower mean number of nests per hectare than region B, with \(95\%\) confidence.
-
c) The third test is the permutation with \(B=25000\) resamplings. For this, we used the same program previously presented and applied for the bootstrap test. The result led to the same value of the statistic \(t_c\) \(=\) \(-\)4.75 as the bootstrap, but whose \(p\)-value is 0.0000. Thus, again it is concluded that region A has a lower mean number of nests per hectare than region B, with \(95\%\) confidence.
-
d) The fourth test is that of Brunner & Munzel (2000), whose previous hypothesis is equivalent to:
\(\seteqnumber{0}{11.}{0}\)\begin{align*} H_0:&\,\, p = \dfrac {1}{2} &\textrm { versus } && H_1:&\,\,p \ne \dfrac {1}{2}, \end{align*} where \(p\) is the relative treatment effect.
The sample ranks within each region are:
Region Ranks of the number of nests of each sample A 5.5 1 2 10 3 7 9 8 4 5.5 B 4 5 7 2 1 3 6 Finally, the sample ranks within each region, but originating from the combined sample are:
Region Ranks of the number of nests of the combined sample A 5.5 1 2 11.5 3 7 9.5 8 4 5.5 B 14 15 17 11.5 9.5 13 16 The means of the ranks for the two samples are
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \bar {R}_{1.} =& 5.7 &\textrm { and } && \bar {R}_{2.} =& 13.71429. \end{align*} The estimate of the relative effect of region is \(\hat {p}\) \(=\) \(0.9714\), indicating, without considering randomness, that region \(1\) (A) has a lower mean than region \(2\) (B), since the estimate was greater than \(0.5\). This should or should not be confirmed by the significance with the application of the formal test that follows.
The empirical variance is computed, for each \(i\), by
\(\seteqnumber{0}{11.}{0}\)\begin{align*} S^2_i =& \dfrac {1}{n_i-1}\sum _{j=1}^{n_i}\left (R_{ij}-R^{(i)}_{ij}-\bar {R}_{i.}+ \dfrac {n_i+1}{2}\right )^2, \end{align*} resulting in
\(\seteqnumber{0}{11.}{0}\)\begin{align*} S^2_1 =& 0.2333 &\textrm { and } && S^2_2 =& 0.3214. \end{align*}
Therefore, the estimator
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \hat {\sigma }_i^2 =& \dfrac {S^2_i}{(n-n_i)^2}, \end{align*} provides the following estimates
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \hat {\sigma }_1^2=& 0.004762 &\textrm { and } && \hat {\sigma }_2^2=& 0.003214. \end{align*}
The estimator of the variance of \((\bar {R}_{2.}-\bar {R}_{1.})/\sqrt {n}\), given by
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \hat {\sigma }^2_n=& n\left (\dfrac {\hat {\sigma }_1}{n_1} + \dfrac {\hat {\sigma }_2}{n_2}\right ), \end{align*} provides the following estimate \(\hat {\sigma }^2_n\) \(=\) \(0.015901\).
Thus, the value of the test statistic is
\(\seteqnumber{0}{11.}{0}\)\begin{align*} W_n^{BF} =& \dfrac {\bar {R}_{2.}-\bar {R}_{1.}}{\hat {\sigma }_n\sqrt {n}}= \dfrac {13.71429-5.7}{\sqrt {17\times 0.01590136}}=15.41428. \end{align*}
The \(p\)-value can be obtained, assuming that its value is a realization of a standard normal variable. Thus, considering the alternative hypothesis (bilateral test), the \(p\)-value is given by
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \textrm {$p$-value} =& 2\times (1-P(Z>15.4142))=0. \end{align*}
However, using the best approximation recommended by the authors, which is the Student’s \(t\), the \(p\)-value was also calculated. The degrees of freedom of this approximation are
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \nu =& \dfrac {\left (\dfrac {\hat {\sigma }^2_1}{n_1}+ \dfrac {\hat {\sigma }^2_2}{n_2}\right )^2}{\dfrac {\left (\dfrac {\hat {\sigma }^2_1}{n_1}\right )^2}{n_1-1} + \dfrac {\left (\dfrac {\hat {\sigma }^2_2}{n_2}\right )^2}{n_2-1}}\\ =& 14.5007. \end{align*}
Thus, the \(p\)-value, using the \(t\) approximation, is
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \textrm {$p$-value} =& 2\times (1-P(T>3.137467;\nu =18))=2.1541\times 10^{-10}. \end{align*}
The hypothesis that the two regions have a mean number of nests per hectare must be rejected at the nominal level of \(5\%\), and it can be stated that region A has a lower mean number of nests per hectare than region B.
Alternatively or even in a complementary way, the upper one-sided interval (upper), using the Student’s \(t\) approximation, was also obtained and is given by \([\)0.9632, 0.9797\(]\). Since the hypothesized value, which is \(p\) \(=\) \(0.5\), which corresponds to no relative effect of region, is not in the confidence interval, the hypothesis would also be rejected at the nominal significance level of \(5\%\). Thus, the real value of \(p\) is greater than \(0.5\), and should be a value between 0.96 and 0.98, with \(95\%\) confidence, indicating that region A has a lower mean number of nests than region B.
-
e) The fifth test is that of Wilcoxon (1947) and Mann & Whitney (1947).
Let us combine the two samples and sort the resulting sample, keeping the identification of the region of origin (\(1\) for region A and \(2\) for region B). The values thus obtained are presented below.
Region \(X_{i(j)}\) \(R_{ij}\) 1 0 1.0 1 1 2.0 1 8 3.0 1 9 4.0 1 10 5.5 1 10 5.5 1 11 7.0 1 12 8.0 1 13 9.5 2 13 9.5 1 15 11.5 2 15 11.5 2 19 13.0 2 20 14.0 2 21 15.0 2 22 16.0 2 25 17.0 The totals of the ranks of each clone are
\(\seteqnumber{0}{11.}{0}\)\begin{align*} R_{1.} =& 57 & \textrm { and } && R_{2.}=& 96. \end{align*}
It is easy to see that the sum of the two values must total \(n(n + 1)/2\) \(=\) \(17(17 + 1)/2\) \(=\) \(153\). This is a way to check whether the values found are correct. Thus, the values of the Wilcoxon statistics are
\(\seteqnumber{0}{11.}{0}\)\begin{align*} W_{1} =& R_{1.}= 57 & \textrm { and } && W_2=& R_{2.}= 96. \end{align*}
The corresponding values of the statistic \(U\) are
\(\seteqnumber{0}{11.}{0}\)\begin{align*} U_1=& W_1 - \dfrac {n_1(n_1+1)}{2} = 57 - \dfrac {10\times 11}{2}=2 \end{align*} and
\(\seteqnumber{0}{11.}{0}\)\begin{align*} U_2=& W_2 - \dfrac {n_2(n_2+1)}{2} = 96 - \dfrac {7\times 8}{2}=68. \end{align*}
Consulting Table A.11 for \(\alpha \) \(=\) \(5\%\) we obtain the following value: \(U_{0.05}\) \(=\) \(56\). Thus, the value \(U_{0.95}\) is obtained by \(U_{0.95}\) \(=\) \(n_1n_2 - U_{0.05}\) \(=\) \(10\times 7\) \(-\) \(56\) \(=\) \(14\). Since ties occurred, the tabulated values represent only approximate critical values of the null distribution of this test. Since the calculated value \(U_1\) \(=\) \(2\) is less than the tabulated value \(U_{0.95}\) \(=\) \(14\), the null hypothesis must be rejected, considering the nominal value of \(5\%\) significance, that is, region A has a lower mean number of nests per hectare than region B.
Next, the normal approximation with and without adjustment of the standard normal score and considering continuity correction is presented. The mean of \(U\) is given for this case by
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \mu _U=& \dfrac {n_1n_2}{2}=\dfrac {10\times 7}{2}=35. \end{align*}
Observing the ordered data and the ranks of the previous table, it is possible to see that \(g = 3\) groups of ties occurred. The values of the number of ties in each of the groups are \(t_1\) \(=\) \(2\), \(t_2\) \(=\) \(2\) and \(t_3\) \(=\) \(2\). Thus,
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \sum _{j=1}^{g} (t_j^3-t_j)=& (2^3-2)+(2^3-5)+(2^3-2)=18. \end{align*}
Thus, the variance of \(U\) is equal to
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \sigma ^2_U=& \dfrac {n_1n_2\left [n^3-n-\displaystyle \sum _{j=1}^{g} (t_j^3-t_j)\right ]}{12n(n-1)}\\ =& \dfrac {10\times 7\times (17^3-17-18)}{12\times 17\times (17-1)}\\ =& 104.6140. \end{align*}
The value of \(Z_c\), without considering the adjustment for a better approximation, is given by
\(\seteqnumber{0}{11.}{0}\)\begin{align*} Z_c =& \dfrac {|U-\mu _U|-0.5}{\sigma _U} \\ =&\dfrac {|2-35|-0.5}{\sqrt {104.613970588}}\\ =&3.1775. \end{align*}
The \(p\)-value obtained from the standard normal distribution by \(P(Z >\)3.1775\()\) is equal to 0.00149. Thus, since this value is less than the nominal significance value adopted of \(0.05\), the null hypothesis \(H_0\) must be rejected. The conclusion obtained is the same as before, that is, region A has a lower mean number of nests per hectare than region B. To improve the normal approximation, it is necessary to calculate the values henceforth presented. Thus,
\(\seteqnumber{0}{11.}{0}\)\begin{align*} A=& \dfrac {20n_1n_2(n_1+n_2+1)}{n_1^2+n_2^2+n_1n_2+n_1+n_2}=106.7797, &&& B=& \dfrac {155Z_c^4-416Z_c^2-195}{42}=271.5676,\\ C=& 1+\dfrac {Z_c^2-3}{A}+\dfrac {B}{A^2}=1.0903 &\textrm { and }&& Z'_c=& C Z_c=3.4644. \end{align*}
The \(p\)-value for this case was equal to 0.000531, which did not change the conclusion previously obtained, but is more reliable. If there is divergence, this is the most reliable result.
In summary, all procedures led to the same conclusion. The test considering the normal distribution and homogeneous variances led to the same conclusion (results not shown), showing the robustness of the \(t\) test when the normality assumption is violated.
-
-
11.2.7 For this example we have two situations. The first, in which the means and variances are homogeneous and the second in which only the means are homogeneous. The details of each case are presented below.
-
a) For the first case in which the means and variances are homogeneous, the confidence interval is:
\(\seteqnumber{0}{11.}{0}\)\begin{align*} CI_{1-\alpha }(\mu ):&\,\,\bar {X}_p \pm t_{\alpha /2;\nu }\sqrt {\dfrac {S^2_p}{n_1+n_2}}, \end{align*} where
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \bar {X}_p=& \dfrac {n_1\bar {X}_1+n_2\bar {X}_2}{n_1+n_2}, \end{align*} \(\nu =n_1+n_2-2\) and
\(\seteqnumber{0}{11.}{0}\)\begin{align*} S^2_p=& \dfrac {(n_1-1)S_1^2 + (n_2-1)S_2^2}{n_1+n_2-2}. \end{align*} Thus, we have
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \bar {X}_p=& \dfrac {21\times 8.5+35\times 8.1}{21+35}\\ =& 8.25, \end{align*} \(\nu \) \(=\) \(54\) and
\(\seteqnumber{0}{11.}{0}\)\begin{align*} S^2_p=& \dfrac {(21-1)\times 1.87 + (35-1)\times 2.14}{21+35-2}\\ =& 2.04. \end{align*} Thus,
\(\seteqnumber{0}{11.}{0}\)\begin{align*} CI_{0.95}(\mu ):&\,\,8.25 \pm t_{0.025;54}\sqrt {\dfrac {2.04}{21+35}}\\ &\,\,8.25 \pm 2.0049\times 0.1909=\,\,8.25 \pm 0.3827\\ &[7.87,\,\,8.63]. \end{align*}
Therefore, with \(95\%\) confidence the common population mean is a potential value of this interval. The second option presented in the Book will not be considered here and is left as an additional task for the reader to obtain it.
-
b) For the second case in which the means are homogeneous, but the variances are different, the confidence interval can be obtained by the approximation of Zar (1996) or by the exact interval presented in the Book. We will obtain both confidence intervals, to illustrate the procedures.
-
i) The approximation of Zar (1996):
The interval in this case is:
\(\seteqnumber{0}{11.}{0}\)\begin{align*} CI_{1-\alpha }(\mu ):&\,\,\bar {X}_p \pm t_{\alpha /2;\nu }\sqrt {\dfrac {1}{2} \left (\dfrac {S^2_1}{n_1+n_2} + \dfrac {S^2_2}{n_1+n_2}\right )}, \end{align*} where \(\nu \) is given by
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \nu =& \dfrac {\left (\dfrac {S^2_1}{n_1}+ \dfrac {S^2_2}{n_2}\right )^2}{ \dfrac {\left (\dfrac {S^2_1}{n_1} \right )^2}{n_1-1}+ \dfrac {\left (\dfrac {S^2_2}{n_2} \right )^2}{n_2-1}}. \end{align*} The degrees of freedom are:
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \nu =& \dfrac {\left (\dfrac {5.21}{30}+ \dfrac {1.98}{35}\right )^2}{ \dfrac {\left (\dfrac {5.21}{30} \right )^2}{30-1}+ \dfrac {\left (\dfrac {1.98}{35} \right )^2}{35-1}}\\ =& 46.7403. \end{align*} Thus, using the same formula to obtain \(\bar {X}_p\) we have
\(\seteqnumber{0}{11.}{0}\)\begin{align*} CI_{0.95}(\mu ):&\,\,12.5307 \pm t_{0.975;46.7403} \sqrt {\dfrac {1}{2} \left (\dfrac {5.21}{30+35} + \dfrac {1.98}{30+35}\right )}\\ &\,\,12.5307 \pm 2.0120\times 0.2352\\ &\,\,12.5307 \pm 0.4732\\ &\,\,[12.06,\,\,13.00]. \end{align*} Therefore, with \(95\%\) confidence the common population mean is a potential value of this interval.
-
ii) The approximation developed in the Book:
The confidence interval is given by
\(\seteqnumber{0}{11.}{0}\)\begin{align*} CI_{1-\alpha }(\mu ):&\,\,\bar {X}_p \pm t_{\alpha /2;\nu }\sqrt {\dfrac {n_1 S^2_1+n_2 S^2_2}{(n_1+n_2)^2}}, \end{align*} where the degrees of freedom \(\nu \) are given by
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \nu =& \dfrac {(n_1-1)(n_2-1)(n_1 S^2_1+n_2 S^2_2)^2}{(n_1S^2_1)^2(n_2-1)+ (n_2S^2_2)^2(n_1-1)}, \end{align*} obtained by direct application of the formula of Satterthwaite (1946).
Thus, the degrees of freedom are:
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \nu =& \dfrac {(30-1)(35-1)(30\times 5.21+35\times 1.98)^2}{(30\times 5.21)^2\times (35-1)+ (35\times 1.98)^2\times (30-1)}\\ =& 51.741183. \end{align*} Thus, the confidence interval is:
\(\seteqnumber{0}{11.}{0}\)\begin{align*} CI_{0.95}(\mu ):&\,\,12.5307 \pm t_{0.975;51.741183} \sqrt {\dfrac {30\times 5.21+35\times 1.98}{(30+35)^2}}\\ & \,\,12.5307 \pm 2.0069\times 0.231077\\ & \,\,12.5307 \pm 0.4637\\ &\,\,[12.06,\,\,12.99]. \end{align*} Therefore, with \(95\%\) confidence the common population mean is a potential value of this interval. This interval provides, in simulation studies, exact coverage probability, unlike the approximation of Zar (1996).
-
-
-
11.2.8 To estimate the difference of means with margin of error \(e\) \(=\) 0.5 t/ha and \(95\%\) confidence we should use the expression
\(\seteqnumber{0}{11.}{0}\)\begin{align*} n =& \dfrac {2 S^2_p t_{\alpha /2;\nu }^2}{e^2}, \end{align*} which must be solved iteratively and assumes that the samples of both populations are equal, that is, that \(n_1\) \(=\) \(n_2\) \(=\) \(n\). The pooled variance is \(S^2_p\) \(=\) 3.727. The initial value of \(n_1\) \(=\) \(10\) and \(n_2\) \(=\) \(12\), gives us an initial value of \(\nu =20\) degrees of freedom, if we use the pilot sample values for this. Thus, \(t_{0.025;\nu =20}\) \(=\) 2.085963. Thus,
\(\seteqnumber{0}{11.}{0}\)\begin{align*} n =& \dfrac {2 \times 3.727 \times 2.085963^2}{0.5^2}\\ =& 129.7367\cong 130. \end{align*}
Since this value is different from the initial mean value (\(n\) \(=\) \(11\)), we must repeat the process with the new value, which results in \(t_{0.025;\nu =258}\) \(=\) 1.969201. Therefore,
\(\seteqnumber{0}{11.}{0}\)\begin{align*} n =& \dfrac {2 \times 3.727 \times 1.969201^2}{0.5^2}\\ =& 115.6197\cong 116. \end{align*}
again the current value differs from the previous one, so we must repeat the process with this new value of \(n\) and obtain the next one. The new value is
\(\seteqnumber{0}{11.}{0}\)\begin{align*} n =& \dfrac {2 \times 3.727 \times 1.970332^2}{0.5^2}\\ =& 115.7519\cong 116. \end{align*}
Since the current value of \(n\) is equal to the previous one, we interrupt the process. We will need \(n_1\) \(=\) \(n_2\) \(=\) \(116\) sampling units of each cultivar to estimate the difference of means with margin of error of 0.5 t/ha and confidence of \(95\%\).
-
11.2.9 Considering equal variances and identical sample sizes in a bilateral test with \(n_1\) \(=\) \(n_2\) \(=\) \(116\), we have
\(\seteqnumber{0}{11.}{0}\)\begin{align*} t_{1-\beta ;\nu } \le & t_{\alpha /2;\nu } - \dfrac {d\sqrt {n}}{\sqrt {2S^2_p}}\\ & =t_{0.025;\nu =230}-\dfrac {0.3\times \sqrt {116}}{\sqrt {2\times 3.74}}\\ & = 1.9703-1.1814=0.7889. \end{align*}
Thus, the maximum value must be considered, that is, \(t_{1-\beta ;\nu }\) \(=\) 0.7889. The power \(1-\beta \) is obtained considering the value of the probability of the following event \(P(T >\)0.7889\()\) of the Student’s \(t\) distribution with \(\nu \) \(=\) \(230\) degrees of freedom. Thus, \(1-\beta \) \(\approx \) 0.2155.
The approximate power of the test is only 21.55% to detect a difference of 0.3 t/ha with \(95\%\) confidence. The exact power value in this case is 21.64% (calculations not shown). If the sample sizes of the pilot sample were considered (\(n_1\) \(=\) \(10\) and \(n_2\) \(=\) \(12\)), then the exact power would be only 6.20%.
To answer the second part, the value of \(n\) is given by \(n\) \(=\) \(n_1\) \(=\) \(n_2\) \(=\) \(116\), that is, both samples have the same size. Thus,
\(\seteqnumber{0}{11.}{0}\)\begin{align*} d \ge & \left (t_{\beta ;\nu }+t_{\alpha /2;\nu }\right ) \sqrt {\dfrac {2S^2_p}{n}}\\ =& (t_{0.05;\nu =230}+ t_{0.025;\nu =230})\sqrt {\dfrac {2\times 3.74}{116}}\\ =& 0.92 \textrm { t/ha.} \end{align*}
Thus, a minimum significant difference of \(0.92\) t/ha would be detected with \(95\%\) confidence and \(95\%\) power (\(\beta \) \(=\) \(0.05\)). This is an expressive difference in practical terms, given the variability present in yield and the large values of power and confidence fixed. This indicates that the sample sizes that were used are quite inexpressive (small) to detect differences of means of small magnitudes with high power.
-
11.2.10 The \(95\%\) and \(99\%\) confidence intervals for the present case are presented in the sequence. The data provided are:
Fungus Region \(1\) Region \(2\) Sick 10 50 Healthy 290 250 Total 300 300 The point estimates for the two regions using the two estimators presented are
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \hat {p}_1 =& \dfrac {10}{300}=0.033333 & \textrm { and } && \tilde {p}_1 =& \dfrac {10+1}{300+2}=0.036424,\\ \hat {p}_2 =& \dfrac {50}{300}=0.166667 & \textrm { and } && \tilde {p}_2 =& \dfrac {50+1}{300+2}=0.168874. \end{align*}
-
a) Wald interval (normal approximation)
\(\seteqnumber{0}{11.}{0}\)\begin{align*} CI_{0.95}(\Delta ): &\,\, \hat {p}_1-\hat {p}_2 \pm Z_{\alpha /2} \sqrt {\dfrac {\hat {p}_1(1-\hat {p}_1)}{n_1} + \dfrac {\hat {p}_2(1-\hat {p}_2)}{n_2}}\\ & = 0.0333-0.1667\pm 1.96\sqrt {\dfrac {0.0333\times (1-0.0333)}{300} + \dfrac {0.1667\times (1-0.1667)}{300}}\\ &= -0.1333\pm 0.0468 =[-0.1801,\, -0.0865]. \end{align*}
The \(99\%\) confidence interval, using a procedure analogous to the previous one, is \([-\)0.1949, \(-\)0.0718\(]\).
-
b) Normal add-\(4\) interval
\(\seteqnumber{0}{11.}{0}\)\begin{align*} CI_{1-\alpha }(\Delta ): &\,\, \tilde {p}_1-\tilde {p}_2 \pm Z_{\alpha /2} \sqrt {\dfrac {\tilde {p}_1(1-\tilde {p}_1)}{n_1+2} + \dfrac {\tilde {p}_2(1-\tilde {p}_2)}{n_2+2}}\\ &= 0.0364-0.1689 \pm 1.96 \sqrt {\dfrac {0.0364\times (1-0.0364)}{300+2} + \dfrac {0.1689\times (1-0.1689)}{300+2}}\\ & = -0.1325\pm 0.0472 = [-0.1797,\, -0.0852]. \end{align*}
The \(99\%\) confidence interval, using a procedure analogous to the previous one, is \([-\)0.1945, \(-\)0.0704\(]\).
-
c) \(T2\) interval
To calculate the \(T2\) interval, it is necessary to obtain the degrees of freedom of Student’s \(t\) first. We know that \(\hat {V}(\tilde {p}_1)\) \(=\) \(0.0364\times (1-0.0364)/(300+2)\) \(=\) 0.0001162157 and \(\hat {V}(\tilde {p}_2)\) \(=\) 0.0004647539. The expression used to obtain the degrees of freedom is
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \nu \approx & \dfrac {2\left [\hat {V}(\tilde {p}_1)+ \hat {V}(\tilde {p}_2) \right ]^2}{\hat {V}\left (\hat {V}(\tilde {p}_1)\right ) + \hat {V}\left (\hat {V}(\tilde {p}_2)\right )} = \dfrac {2\times [0.0001162157 + 0.0004647539]^2}{\hat {V}\left (\hat {V}(\tilde {p}_1)\right ) + \hat {V}\left (\hat {V}(\tilde {p}_2)\right )}\\ \approx & \dfrac {2\times 0.0005809696^2}{\hat {V}\left (\hat {V}(\tilde {p}_1)\right ) + \hat {V}\left (\hat {V}(\tilde {p}_2)\right )}. \end{align*}
But, \(\hat {V}(\hat {V}(\tilde {p}_i))\), without reproducing the calculations here, is equal to
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \hat {V}\left (\hat {V}(\tilde {p}_1)\right ) =& 1.088404\times 10^{-9} &\textrm { and }&& \hat {V}\left (\hat {V}(\tilde {p}_2)\right ) =& 2.22483\times 10^{-9}. \end{align*}
Thus,
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \nu \approx & \dfrac {2\times 0.0005809696^2}{1.088404\times 10^{-9}+ 2.22483\times 10^{-9}} = 203.744. \end{align*}
The value of the upper quantile of the Student’s \(t\) distribution with \(\nu \) \(=\) \(203.744\) degrees of freedom is \(t_{0.025;\nu =203.744}\) \(=\) \(1.971676\). The confidence interval is, therefore,
\(\seteqnumber{0}{11.}{0}\)\begin{align*} CI_{1-\alpha }(\Delta ): &\,\, \tilde {p}_1-\tilde {p}_2 \pm t_{\alpha /2;\nu } \sqrt {\dfrac {\tilde {p}_1(1-\tilde {p}_1)}{n_1+2} + \dfrac {\tilde {p}_2(1-\tilde {p}_2)}{n_2+2}}\\ &= 0.0364-0.1689 \pm 1.971676 \sqrt {\dfrac {0.0364(1-0.0364)}{300+2} + \dfrac {0.1689(1-0.1689)}{300+2}}\\ & = -0.1325\pm 0.0475 = [-0.1800,\, -0.0849]. \end{align*}
The \(99\%\) confidence interval, using a procedure analogous to the previous one, is \([-\)0.1951, \(-\)0.0698\(]\).
-
d) bootstrap intervals of Conlon & Thomas (1990) and adapted from Agresti & Caffo (2000) in this Book:
The point estimates used to estimate the joint probability function of the binomial proportions of the two regions are: a) \(\hat {p}_1\) \(=\) 0.033333 and \(\hat {p}_2\) \(=\) 0.166667 for the case of the bootstrap interval of Conlon & Thomas (1990); and b) \(\tilde {p}_1\) \(=\) 0.036424 and \(\tilde {p}_2\) \(=\) 0.168874 for the case of the bootstrap interval of Agresti & Caffo (2000). A summary of the bootstrap distributions of \(\hat {d}\) using the two methods is presented. The values were sorted and a sample of the bootstrap null distribution of size \(10000\) was considered. To generate the values of \(\hat {d}\) for one of the steps, two binomial numbers are generated considering probability of success equal to 0.0133333 with \(n_1\) \(=\) \(300\) and probability of success \(0.166667\) with \(n_2\) \(=\) \(300\) for the Conlon and Thomas method and two binomial numbers considering probability of success equal to 0.036424 with \(n_1\) \(=\) \(300\) and probability of success 0.168874 with \(n_2\) \(=\) \(300\) for the Agresti and Caffo method. Then, for each method the value of \(d\) is calculated in the same way, \(\hat {d}\) \(=\) \(y_1/n_1-y_2/n_2\). The process is repeated and these values are sorted. A summary of how the results obtained are is presented below.
Sample \(j\) \(\hat {d}\) of Conlon and Thomas \(\hat {d}\) of Agresti and Caffo 1 -0.22333 -0.23000 2 -0.21667 -0.22667 3 -0.21333 -0.22333 \(\vdots \) \(\vdots \) \(\vdots \) 9,999 -0.05000 -0.04667 10,000 -0.04333 -0.04667 The \(2.5\%\) and \(97.5\%\) quantiles were obtained from each distribution and the \(95\%\) confidence intervals generated are the following, which were identical in the two bootstrap cases:
Conlon and Thomas: \(CI_{0.95}(\Delta )\): \([-\)0.180000, -0.086667\(]\)
The \(99\%\) confidence interval, using a procedure analogous to the previous one, is \([-\)0.1967, \(-\)0.0733\(]\).
Agresti and Caffo: \(CI_{0.95}(\Delta )\): \([-\)0.180000, -0.086667\(]\)
The \(99\%\) confidence interval, using a procedure analogous to the previous one, is \([-\)0.1967, \(-\)0.0733\(]\).
Relatively close results among all methods were obtained, indicating that the proportion of sick individuals in region \(1\) is less than that of region \(2\), both for \(95\%\) and \(99\%\) confidence.
-
-
11.2.11 The null hypothesis is
\(\seteqnumber{0}{11.}{0}\)\begin{align*} H_0:\,\,\Delta =& p_1 - p_2=\Delta _0=0 &\textrm { and } && H_1:\,\,\Delta \ne & 0. \end{align*}
The estimates of \(p_1\) and \(p_2\), for the Wald test, are
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \hat {p}_1 =& \dfrac {y_1}{n_1}=\dfrac {435}{1200}=0.3625 & \textrm { and } && \hat {p}_2 =& \dfrac {y_2}{n_2}=\dfrac {389}{1250}=0.3112. \end{align*}
The estimate of the common \(p\), also the Wald test, is given by
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \hat {p} =& \dfrac {n_1\hat {p}_1+n_2\hat {p}_2}{n_1+n_2}=\dfrac {y_1+y_2}{n_1+n_2} = \dfrac {435+389}{1200+1250}=0.3363265. \end{align*}
Likewise, the estimates of \(p_1\), \(p_2\) and of the common \(p\), for the approximation of Agresti & Caffo (2000) and the modification of the test of Agresti & Caffo (2000), are
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \tilde {p}_1 =& \dfrac {y_1+1}{n_1+2}=\dfrac {435+1}{1200+2}=0.3627288, &&& \tilde {p}_2 =& \dfrac {y_2+1}{n_2+2}=\dfrac {389+1}{1250+2}=0.3115016\\ \tilde {p} =& \dfrac {y_1+y_2+2}{n_1+n_2+4}=\dfrac {435+389 + 2}{1200+1250+4}=0.3365933. &&& & \end{align*}
-
a) Wald test
To test the hypothesis \(H_0\), we calculate
\(\seteqnumber{0}{11.}{0}\)\begin{align*} Z_c=& \dfrac {\hat {p}_1-\hat {p}_2}{\sqrt {\dfrac {\hat {p}(1-\hat {p})(n_1+ n_2)}{n_1n_2}}}\\ =& \dfrac {0.3625-0.3112}{\sqrt {\dfrac {0.3363265\times (1-0.3363265)\times (1200+1250)}{1200\times 1250}}}\\ =& 2.6867. \end{align*}
The \(p\)-value is given by
\(p\)-value = \(P(Z > |2.6867|)\) \(=\) \(2\times 0.003607\) \(=\) \(0.0072\).
Since the \(p\)-value is less than \(0.05\), it is concluded that there is significant evidence to reject the null hypothesis of equality of the incidence of bifurcation in the two varieties. Variety \(1\) has a lower bifurcation proportion than variety \(2\).
-
b) Test of Agresti & Caffo (2000)
To test the hypothesis \(H_0\), initially we calculate
\(\seteqnumber{0}{11.}{0}\)\begin{align*} Z_c=& \dfrac {\tilde {p}_1-\tilde {p}_2}{\sqrt {\dfrac {\tilde {p}(1-\tilde {p})(n_1+ n_2+4)}{(n_1+2)(n_2+2}}} = \dfrac {0.3627288 - 0.3115016}{\sqrt {\dfrac {0.3365933\times (1-0.3365933)\times (1200+1250+4)}{(1200+2)\times (1250+2)}}}\\ =& 2.684571. \end{align*}
The \(p\)-value is given by
\(p\)-value \(=\) \(P(Z > |2.684571|)\) \(=\) \(2 \times \) 0.000363 \(=\) 0.00726.
Since the \(p\)-value is less than \(0.05\), it is concluded that there is significant evidence to reject the null hypothesis of equality of the incidence of bifurcation in the two varieties. Variety \(1\) has a lower bifurcation proportion than variety \(2\). Same conclusion obtained previously by the Wald method.
-
c) Modified test of Agresti & Caffo (2000)
To test the hypothesis \(H_0\) using this new method, we initially calculate
\(\seteqnumber{0}{11.}{0}\)\begin{align*} T_c=& \dfrac {\tilde {p}_1-\tilde {p}_2}{\sqrt {\dfrac {\tilde {p}(1-\tilde {p})(n_1+ n_2+4)}{(n_1+2)(n_2+2}}} \\ =& \dfrac {0.3627288 - 0.3115016}{\sqrt {\dfrac {0.3365933\times (1-0.3365933)\times (1200+1250+4)}{(1200+2)\times (1250+2)}}}\\ =& 2.684571, \end{align*} which is the same value as the previous case. It is also necessary to obtain
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \hat {V}\left (\hat {V}(\tilde {p}_1-\tilde {p}_2)\right ) =& 2.593191\times 10^{-11}. \end{align*}
The degrees of freedom are given by
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \nu \approx & \dfrac {2\left [\hat {V}(\tilde {p}_1-\tilde {p}_2) \right ]^2}{\hat {V}\left (\hat {V}(\tilde {p}_1-\tilde {p}_2)\right )}\\ & =\dfrac {2\times 0.0003641255^2}{2.593191\times 10^{-11}}\\ &=10225.81. \end{align*}
The \(p\)-value is given by
\(p\)-value \(=\) \(P(T > |2.684571|;\nu =10225.81)\) \(=\) \(2 \times 0.003636996\) \(=\) 0.00727.
Since the \(p\)-value is less than \(0.05\), it is concluded that there is significant evidence to reject the null hypothesis of equality of the incidence of bifurcation in the two varieties. Variety \(1\) has a lower bifurcation proportion than variety \(2\). Same conclusion obtained by the methods presented previously. The high value of the degrees of freedom indicates that the normal approximation of item (b) is good.
-
-
11.2.12 in both cases, normality was assumed and, therefore, we can apply the \(F\) test in both cases. The null hypothesis in both cases is:
\(\seteqnumber{0}{11.}{0}\)\begin{align*} H_0: \sigma ^2_1 =& \sigma ^2_2, \end{align*} where the indices \(1\) and \(2\) refer to populations \(A\) and \(B\), in the first case and to populations \(C\) and \(D\), in the second case, respectively.
-
a) In the first case, we have \(n_1\) \(=\) \(21\), \(S^2_1\) \(=\) 1.87, \(n_2\) \(=\) \(35\) and \(S^2_2\) \(=\) 2.14, then \(F_c\) is given by
\(\seteqnumber{0}{11.}{0}\)\begin{align*} F_c=& \dfrac {S^2_1}{S^2_2}=\dfrac {1.87}{2.14}=0.8738, \end{align*} associated with \(\nu _1 = 20\) degrees of freedom of the variance of the numerator of the expression (population \(1\)) and \(\nu _2 = 34\) degrees of freedom associated with the denominator of the expression (population \(2\)). Thus, we have
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \textrm {$p$-value} =& 2\times \min (P(F\le 0.8738;\nu _1=20,\nu _2=34),P(F\ge 0.8738;\nu _1=20,\nu _2=34))\\ =& 2\times \min (0.382653, 0.617347)\\ =&0.765306. \end{align*}
Since the \(p\)-value is greater than the nominal value of \(5\%\), it is concluded that there is no significant evidence to reject the null hypothesis of equality of population variances. Therefore, this result corroborates the statement of the referred exercise of considering the variances homogeneous.
-
b) In the second case, we have \(n_1\) \(=\) \(30\), \(S^2_1\) \(=\) 5.21, \(n_2\) \(=\) \(35\) and \(S^2_2\) \(=\) 1.98, then \(F_c\) is given by
\(\seteqnumber{0}{11.}{0}\)\begin{align*} F_c=& \dfrac {S^2_1}{S^2_2}=\dfrac {5.21}{1.98}=2.6313, \end{align*} associated with \(\nu _1 = 29\) degrees of freedom of the variance of the numerator of the expression (population \(1\)) and \(\nu _2 = 34\) degrees of freedom associated with the denominator of the expression (population \(2\)). Thus, we have
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \textrm {$p$-value} =& 2\times \min (P(F\le 2.6313;\nu _1=29,\nu _2=34),P(F\ge 2.6313;\nu _1=29,\nu _2=34))\\ =& 2\times \min (0.9963, 0.0037)\\ =&0.0074. \end{align*}
Since the \(p\)-value is less than the nominal value of \(5\%\), it is concluded that there is no significant evidence to reject the null hypothesis of equality of population variances. Therefore, this result corroborates the statement of the referred exercise of considering the variances heterogeneous.
-
-
11.2.13 The sample results in t/ha are presented below.
Population \(n_i\) \(\bar {X}_i\) (t/ha) \(S^2_i\) \(K_i=S_i/\bar {X}_i\) \(F_1\) 10 265.09 6475.472 0.3036 \(F_2\) 10 255.98 3165.006 0.2198 The null hypothesis is \(H_0\): \(\kappa _1\) \(=\) \(\kappa _2\) \(=\) \(\kappa \). Thus, the combined estimator of the common coefficient of variation of both populations considering the null hypothesis as true is
\(\seteqnumber{0}{11.}{0}\)\begin{align*} K_p =& \dfrac {n_1K_1+n_2K_2}{n_1+n_2}\\ =&\dfrac {10\times 0.3036+10\times 0.2198}{35}\\ =0.2617. \end{align*}
Using the chi-square approximation, since it is equivalent to the test using the normal approximation, we obtain
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \chi ^2_c =& \sum _{i=1}^{q} \dfrac {n_i(K_i-K_p)^2}{K_p^2(K_p^2+0.5)}\\ =& \dfrac {15\times (0.3036-0.2617)^2+20\times (0.2198-0.2617)^2}{0.2617^2\times (0.2617^2+0.5)}\\ =&0.9017. \end{align*}
The \(p\)-value, considering \(\nu \) \(=\) \(1\) degree of freedom, is given by
\(\seteqnumber{0}{11.}{0}\)\begin{align*} \textrm {$p$-value} =& P(\chi ^2 \ge 0.9017;\nu =1)=0.3423. \end{align*}
Therefore, by the chi-square test it can be inferred that there is no significant evidence at the nominal value of \(5\%\) that the null hypothesis of equality of the coefficients of variation of the two treatments in the chemical constitution in the tibia of the birds should be rejected.