1. Statistical Inference (Parametric Test Under Normal Assumption):
Two problems will be considered:
- One sample problem
- Two sample problem
(a) One Sample Problem:
X, X, …, X i.i.d. normal random variables with mean and variance . For testing , the statistic, , can be used, where and is the sample variance and n is the sample size. Theoretically, as H is true, t is distributed as a t distribution with degrees of freedom n-1.
Example (Splus):
>t.test(light,mu=990) # test H: vs H:
>t.test(light,conf.level=0.9,mu=990) # 90% confidence interval can be obtained
>t.test(light,alternative=”greater”,mu=990) # test H: vs H: >990
>help(t.test)
>qt(0.975,19)
(b) Two Sample Problem:
Suppose X, X, …, X are i.i.d. normal random variables with mean and variance and Y, Y,…, are i.i.d. random variables with mean and variance . X’s and Y’s are independent. To test H: , we first need to check if H: =.
(i) Variance test:
For testing H: =, the statistic can be used, where and are the estimates of and , respectively, and where and . Intuitively, if H is true, F statistic should be close to 1. On the other hand, if F statistic has much larger value than 1, then this might imply H is not true. Theoretically, as H is true, F is distributed as F distribution with degrees of freedom n-1 and m-1.
Example (Splus):
Protein(H) / 134 / 146 / 104 / 119 / 124 / 161 / 107 / 83 / 113 / 129 / 97 / 123Protein(L) / 70 / 118 / 101 / 85 / 107 / 132 / 94
19 rats were divided into two groups, one group with 12 rats and the other with 7 rats. The larger group was given high protein food while the smaller group is given low protein food. The data of the weight gains for these rats under the two diets are given in above table. We now demonstrate the variance test using this data in S-Plus.
>rat1<-c(134,146,104,119,124,161,107,83,113,129,97,123)
>rat2<-c(70,118,101,85,107,132,94)
>var.test(rat1,rat2) # H: =.vs H: ≠
>var.test(rat1,rat2,conf.level=0.9,alt=”g”) # H: =.vs H:
>qf(0.95,11,6) #
(ii) T test:
As the variance test indicates =, then for testing H: , the following statistic can be used , where is the pooled estimate of =.
Example (Splus):
>t.test(rat1,rat2) # H: vs H: ≠
>t.test(rat1,rat2,alt=”g”) # H: vs H: >
As the variance indiates ≠, then for testing H: , the following statistic can be used , where is the estimate of . Theoretically, as H is true, t statistic is approximately t-distribution with (non-integral) degrees of freedom, , where
.
Example (Splus):
>t.test(rat1,rat2,var.equal=F)
1