In: Statistics and Probability
In R:
Consider dataset “juul” from library “ISwR”. (juul is a built in data set)
Are the means of igf1 equal among tanner groups at 5% level?
Please use the six step process to test statistical hypotheses for this research problem.
Note: You need to convert tanner from numeric to factor type and ignore all the NAs.
Solution :
Here , we have to consider the dataset “juul” from library “ISwR” in R software.
To test whether the means of "igf1" are equal among the 5 tanner groups at 5% level.
Step 1) Hypothesis :
Thus , here we are to test the hypothesis ,
where , is the mean of the ith igf1 group.
Here , we are going to use the one - way ANalysis Of VAriance (ANOVA).
The complete ANOVA analysis is done in the R Statistical Software.
Step 2) Assumption :
The assumption of HOMOSCEDASTICITY or EQUAL VARIANCES is considered among the 5 tanner groups.
Step 3) Let the value of the level of significance () be 5% = 0.05.
The appropiate test statistic for testing the above hypothesis is given as ,
k = level of the tanners ; n = total number of observations
Step 4) Rejection Region : We reject the null hypothesis H0 at 5% iff ,
Step 5) Calculations and Output :
The ANOVA table in R is given below.
Clearly , we can see that , the value of the test statistic and the p-value is ,
The critical value is given as ,
Step 6) Conclusion :
Since , and , we Reject the null hypothesis H0 at 5% level of significance and conclude on the basis of the given data that the means of igf1 are not equal among tanner groups at 5% level.
The R codes are given below !!
library(ISwR)
attach(juul)
head(juul)
tanner=juul$tanner
igf1=juul$igf1
igf1[which(is.na(tanner))]=NA
tanner[which(is.na(igf1))]=NA
data.frame(igf1,tanner)
igf1=na.omit(igf1);igf1
tanner=na.omit(tanner);tanner
data.frame(igf1,tanner)
tanner=factor(tanner);tanner
fit=lm(igf1~tanner)
anova(fit)
qf(0.95,4,787)