0% found this document useful (0 votes)
5 views6 pages

Nishant Seth F.Y. BSC Computer Science 2349: Name: Class: Roll No.: Anova

The document presents a series of ANOVA analyses conducted by Nishant Seth, a student in F.Y. BSc Computer Science. It includes five questions where hypotheses are tested regarding the differences in treatment effects for migraines, wheat production, fertilizer yields, sales by season and salesman, and potato production based on seed varieties and fertilizers. The results indicate significant differences in some cases and acceptance of the null hypothesis in others, with p-values provided for each analysis.

Uploaded by

lixice3946
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views6 pages

Nishant Seth F.Y. BSC Computer Science 2349: Name: Class: Roll No.: Anova

The document presents a series of ANOVA analyses conducted by Nishant Seth, a student in F.Y. BSc Computer Science. It includes five questions where hypotheses are tested regarding the differences in treatment effects for migraines, wheat production, fertilizer yields, sales by season and salesman, and potato production based on seed varieties and fertilizers. The results indicate significant differences in some cases and acceptance of the null hypothesis in others, with p-values provided for each analysis.

Uploaded by

lixice3946
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Name: Nishant Seth

Class: F.Y. BSc Computer Science


Roll No.: 2349
ANOVA
Source Code:
# Q1
cat("1.\n")
# H0: There's no significant difference between the drugs used for
treating migraine.
# H1: There's a significant difference between the drugs used for
treating migraine.
pain=c(4,5,4,3,2,4,3,4,4,6,8,4,5,4,6,5,8,6,6,7,6,6,7,5,6,5,5)
length(pain)
drug=c(rep("A",9),rep("B",9),rep("C",9))
migraine=data.frame(pain,drug)
migraine
result=aov(pain~drug,data=migraine)
summary(result)
# pvalue<los(0.05); Reject H0

# Q2
cat("\n2.\n")
# H0: There's no significant difference between varieties of wheats
used for wheat production.
# H1: There's a significant difference between varieties of wheats
used for wheat production.
production=c(20,18,19,17,16,19,18,20,21,20,19,18)
length(production)
varieties=c(rep("A",3),rep("B",4),rep("C",5))
wheat=data.frame(production,varieties)
wheat
result=aov(production~varieties, data=wheat)
summary(result)
# pvalue>los(0.05); Accept H0

# Q3
cat("\n.3\n")
# H0: There's no significant difference between varieties of fertilizers
used in each beds.
# H1: There's a significant difference between varieties of fertilizers
used in each beds.
yields=c(18,22,12,19,19,24,17,11,13,28,12,15,13,27,18,12)
length(yields)
y=c(rep("A",4),rep("B",4),rep("C",4),rep("D",4))
df=data.frame(yields,y)
df
result=aov(yields~y,data=df)
summary(result)
# pvalue > los(0.05); Accept H0
# Q4
cat("\n.4\n")
# H0(1): There's no significant difference in sales due to seasons.
# H1(1): There's a significant difference in sales due to salesmen.
# H0(2): There's no significant difference in sales due to seasons.
# H1(2): There's a significant difference in sales due to salesmen.
sales=c(36,36,21,35,28,29,31,32,26,28,29,29)
f1=c(rep(1:3,rep(4,3)))
f2=rep(c("A","B","C","D"),3)
f1
f2
season=factor(f1)
salesman=factor(f2)
result=aov(sales~season+salesman)
summary(result)
# pvalue(1)>los(0.05); Accept H0(1)
# pvalue > los(0.05); Accept H0(2)

# Q5
cat("\n.5\n")
# H0(1): There's no significant difference in potato production due to
varieties of seeds.
# H1(1): There's a significant difference in potato production due to
varieties of seeds.
# H0(2): There's no significant difference in potato production due to
varieties of fertilizers.
# H1(2): There's a significant difference in potato production due to
varieties of fertilizers.
yields=c(19,22,26,18,21,25,19,22,26,22,17,19,22,20,21,21,18,25,22,2
5)
f1=c(rep(1:4,rep(5,4)))
f2=rep(c("I","II","III","IV","V"),4)
varieties=factor(f1)
fertilizers=factor(f2)
result=aov(yields~variteies+fertilizers)
summary(result)
# pvalue(1)>los(0.05); Accept H0(1)
# pvalue > los(0.05); Accept H0(2)

Output:
1.
[1] 27
pain drug
1 4 A
2 5 A
3 4 A
4 3 A
5 2 A
6 4 A
7 3 A
8 4 A
9 4 A
10 6 B
11 8 B
12 4 B
13 5 B
14 4 B
15 6 B
16 5 B
17 8 B
18 6 B
19 6 C
20 7 C
21 6 C
22 6 C
23 7 C
24 5 C
25 6 C
26 5 C
27 5 C
Df Sum Sq Mean Sq F value Pr(>F)
drug 2 28.22 14.111 11.91 0.000256 ***
Residuals 24 28.44 1.185
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

2.
[1] 12
production varieties
1 20 A
2 18 A
3 19 A
4 17 B
5 16 B
6 19 B
7 18 B
8 20 C
9 21 C
10 20 C
11 19 C
12 18 C
Df Sum Sq Mean Sq F value Pr(>F)
varieties 2 10.05 5.025 3.707 0.0669 .
Residuals 9 12.20 1.356
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

3.
[1] 16
yields y
1 18 A
2 22 A
3 12 A
4 19 A
5 19 B
6 24 B
7 17 B
8 11 B
9 13 C
10 28 C
11 12 C
12 15 C
13 13 D
14 27 D
15 18 D
16 12 D
Df Sum Sq Mean Sq F value Pr(>F)
y 3 1.5 0.50 0.013 0.998
Residuals 12 446.5 37.21

4.
[1] 1 1 1 1 2 2 2 2 3 3 3 3
[1] "A" "B" "C" "D" "A" "B" "C" "D" "A" "B" "C" "D"
Df Sum Sq Mean Sq F value Pr(>F)
season 2 32 16.00 0.706 0.531
salesman 3 42 14.00 0.618 0.629
Residuals 6 136 22.67

5.
Df Sum Sq Mean Sq F value Pr(>F)
varieties 3 25.8 8.600 1.346 0.306
fertilizers 4 42.5 10.625 1.662 0.223
Residuals 12 76.7 6.392

You might also like