BALAJI - Module - 6 7 AOV, CHI
BALAJI - Module - 6 7 AOV, CHI
BALAJI - Module - 6 7 AOV, CHI
[1] Workers<-
c("HANK","HANK","HANK","HANK","HANK","JOSEPH","JOSEPH","JOSEPH","J
OSEPH","JOSEPH","SUSAN","SUSAN","SUSAN","SUSAN","SUSAN")
[2] TIME<-c(8,10,9,11,10,8,9,9,8,10,10,9,10,11,9)
[3] model<-aov(TIME~Workers)
[4] summary(model)
[5] Conclusion
[b] Direct data typing algorithms TWO WAY ANOVA
Suppose if the data is collected on 5 independent shifts S1,S2,S3,S4,S5 ,then
one more hypothesis to be verified for all shifts data.
Hank Joseph Susan [1] H 0: µ H = µ J = µ S
S1 8 8 10 H1: Not all are equal
S2 10 9 9
S3 9 9 10 [2] H0:µs1 = µs2= µs3 = µs4 = µs5
S4 11 8 11 H1: Not all are equal
S5 10 10 9
[1] Workers<-
c("HANK","HANK","HANK","HANK","HANK","JOSEPH","JOSEPH","JOSEPH","J
OSEPH","JOSEPH","SUSAN","SUSAN","SUSAN","SUSAN","SUSAN")
[2] Shifts<-
c("S1","S2","S3","S4","S5","S1","S2","S3","S4","S5","S1","S2","S3","S4","S5"
)
[3] TIME<-c(8,10,9,11,10,8,9,9,8,10,10,9,10,11,9)
#ONE WAY ANOVA
model_1<-aov(TIME~Workers)
summary(model_1)
Conclusion
#TWO WAY ANOVA
model_2<-aov(TIME~Workers+Shifts)
summary(model_2)
conclusion
[c] Direct data reading from file algorithms ONE/TWO WAY ANOVA .
FROM R-DATA FILE>
[1] Chickwts, IS FILE IN R
data(chickwts)
names(chickwts)
w<-chickwts$weight
f<-chickwts$feed
model_1<-aov(w~f)
summary(model_1)
# Example.2
#x is number of customer prefer a product in sample of 200
X=1 PREFER THE PRODUCT , X=0 IF NOT
#claim p=.45 H0:p=0.45 , H1:p≠0.45
x<-rbinom(1,200,p=.45)
x
prop.test(x,200,p=.45)
x<-c(762,327,468)
y<-c(484,239,477)
m<-as.table(rbind(x,y))
m
dimnames(m)<-list( gender = c("F", "M"),drink=c("T","C","L"))
xsq<-chisq.test(m)
xsq
xsq$observed # observed counts (same as m)
xsq$expected # expected counts under the null
xsq$residuals # Pearson residuals
xsq$stdres # standardized residuals
A NEW EX BY ME[BEST]
male<-c(45,60)
females<-c(55,53)
m1<-as.table(rbind(male,females))
m1
r<-c("Male","Female")
c<-c("Tea","Coffee")
dimnames(m1)<-list( gender=r,drink=c)
xsq2<-chisq.test(m1)
xsq2
xsq2$observed # observed counts (same as m1)
xsq2$expected # expected counts under the null
xsq2$residuals # Pearson residuals
xsq2$stdres # standardized residuals
GENDER ADV
YES NO
MALE 34 43
FEMALE 28 23