Group V

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

GROUP V

SMSI/01218/2020 Purity Ekadeli


SMSI/01222/2020 Kenvoy Kevogo
SMSI/O2554/2020 Ian Mugambi
SMSI/01215/2020 Anthony Muli
SMSI/01234/2020 Dadius Ainda
SMSI/01228/2020 Melvine Achieng
SMSI/01205/2020 Victoria Muiruri
SMSI/01208/2020 Vanessa Mwangi

# Load the data

data <- data.frame(

hconc =rep(rep(c(2,4), times=6)),

pressure = rep(rep(c(400,500,650),each =4),times=2),

cookingt= rep(rep(c(3,4),each=6), times=2),

pulp =
c(196.6,196.0,197.7,196.0,199.8,199.4,198.5,197.2,196.0,196.9,198.4,197.6,198.4,198.6,199.6,200.4,2
00.6,200.9,197.5,198.1,198.7,198.0,199.6,199.0))

data

# Fit the fixed effects model

model <- lm(pulp ~ hconc + pressure + cookingt + hconc:pressure + hconc:cookingt + pressure:cookingt,


data = data)

summary(model)

# Normal probability plot versus residuals

qqnorm(model$residuals)

qqline(model$residuals)

# Residuals versus predicted values


plot(model$fitted.values, model$residuals)

# Residuals versus factors

par(mfrow = c(1, 3))

plot(data$hconc, model$residuals, xlab = "hconc", ylab = "Residuals")

plot(data$pressure, model$residuals, xlab = "pressure", ylab = "Residuals")

plot(data$cookingt, model$residuals, xlab = "cookingt", ylab = "Residuals")

par(mfrow = c(1, 1))

# Interaction plot for hconc and pressure

interaction.plot(data$hconc, data$pressure, data$pulp)

# Interaction plot for hconc and cookingt

interaction.plot(data$hconc, data$cookingt, data$pulp)

# Interaction plot for pressure and cookingt

interaction.plot(data$pressure, data$cookingt, data$pulp)

anova(model)

RESULTS…B {i , ii }
> data
hconc pressure cookingt pulp
1 2 400 3 196.6
2 4 400 3 196.0
3 2 400 3 197.7
4 4 400 3 196.0
5 2 500 3 199.8
6 4 500 3 199.4
7 2 500 4 198.5
8 4 500 4 197.2
9 2 650 4 196.0
10 4 650 4 196.9
11 2 650 4 198.4
12 4 650 4 197.6
13 2 400 3 198.4
14 4 400 3 198.6
15 2 400 3 199.6
16 4 400 3 200.4
17 2 500 3 200.6
18 4 500 3 200.9
19 2 500 4 197.5
20 4 500 4 198.1
21 2 650 4 198.7
22 4 650 4 198.0
23 2 650 4 199.6
24 4 650 4 199.0
> # Fit the fixed effects model
> model <- lm(pulp ~ hconc + pressure + cookingt + hconc:pressure +
hconc:cookingt + pressure:cookingt, data = data)
> summary(model)

Call:
lm(formula = pulp ~ hconc + pressure + cookingt + hconc:pressure +
hconc:cookingt + pressure:cookingt, data = data)

Residuals:
Min 1Q Median 3Q Max
-2.1564 -0.5764 0.1750 0.6091 2.6221

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.638e+02 1.833e+01 8.938 7.81e-08 ***
hconc 4.423e-02 1.953e+00 0.023 0.9822
pressure 8.488e-02 3.907e-02 2.173 0.0442 *
cookingt 8.690e+00 5.608e+00 1.550 0.1397
hconc:pressure 5.385e-04 4.542e-03 0.119 0.9070
hconc:cookingt -1.314e-01 9.332e-01 -0.141 0.8897
pressure:cookingt -2.129e-02 9.840e-03 -2.164 0.0450 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1.337 on 17 degrees of freedom


Multiple R-squared: 0.3622, Adjusted R-squared: 0.1371
F-statistic: 1.609 on 6 and 17 DF, p-value: 0.2051

> # Normal probability plot versus residuals


> qqnorm(model$residuals)

Interaction plots
In the above plot, the lines are parallel thus indicating there is no interaction between the two.

In the above plot also the lines are parallel thus showing no interaction between the factors

You might also like