Statistical inference One-Sample T-Test

Statistical inference
One-Sample T-Test
* Definition:
Write information for the test, for example:
Used to compare the mean of a sample to a known number (often the population
mean).
* Assumptions:
Write the assumptions, in one sample t-test they will be:
1- Randomization.
2- Normality (data are normally distributed).
* Discuss the cases of the test statistics:
* Find the R built-in function for the test and explain the arguments:
For one sample t-test:
t.test (x, y=NULL, alternative=” two.sided”, mu=0, paired=F, var.equal=F,
conf.level=.95)
* Give an Example and solve in two methods:
by using R as calculator and by R built-in function
* Discuss the non-parametric test and its R built-in function, give an example, solve
by using R as calculator and by R built-in function.
Example on one sample t-test:
A brochure from a large university indicates that the mean class size is fewer than 32
students. To test their claim, we randomly select 18 classes and determine the class
size of each. The results are as follow:
35 8 29 33 32 40 26 25 29 28 30 36 33 29 27 30 28 25
Test the claim for supporting the university's claim and stat your decision in term of
the problem at α = 0.05.
1. Review data:
Numerical, n=18
Objective: Test the claim for supporting the university's claim that the mean
class size is fewer than 32 students.
2. Check assumption:
a=c(35,8, 29, 33, 32, 40, 26, 25, 29, 28, 30, 36, 33, 29, 27, 30, 28, 25)
eda.shape(a);eda.ts(a)
from the graphs, normality and randomization are satisfied.
ks.test(a,"pnorm",mean(a),sd(a))
H0: the data is normally distributed Vs. H1: the data is not normally distributed
p-value = 0.3853> α = 0.05 don’t reject H0 data is normal.
3. State H0 and H1:
H0: µa=32 Vs. H1: µa<32
where µa represents the mean class size
4. Select test statistic:
Data are normally distributed, n small and σ is unknown t =
x − µ0
~ t n −1
s
n
5. State decision rule:
6. Calculate test statistic:
•
Using R as calculator
Test statistic:
ts=(mean(a)-32)/(sd(a)/sqrt(18))
Rejection Region:
qt(0.05,17)
P-value:
............
•
R built-in function
t.test(a,mu=32,alt="l")
** calculate the confidence interval by using R as calculator
and by using R built-in function.
7. Decision:
reject H0.
8. The conclusion:
There are enough evidences to conclude that the university's claim was not
correct at α=0.05