Factor : Time
High : 18
Low : 12
Factor : Culture Medium
High : 2
Low : 1
knitr::include_graphics("D://UMP//Sem 5//EDA//Lab//Lab Report 5.PNG")
A <- rep(c(-1,1),2)
B <- rep(c(-1,-1,1,1),1)
growth <- c(21,37,25,31,22,39,26,34,23,38,24,29,28,38,25,33,20,35,29,30,26,36,27,35)
data <- data.frame(A,B,growth)
data
results <- lm(growth ~ A+B+A:B, data)
summary(results)
##
## Call:
## lm(formula = growth ~ A + B + A:B, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.333 -1.500 -0.250 1.208 4.667
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 29.6250 0.4614 64.213 < 2e-16 ***
## A 4.9583 0.4614 10.747 9.29e-10 ***
## B -0.6250 0.4614 -1.355 0.190617
## A:B -1.9583 0.4614 -4.245 0.000397 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.26 on 20 degrees of freedom
## Multiple R-squared: 0.8713, Adjusted R-squared: 0.852
## F-statistic: 45.12 on 3 and 20 DF, p-value: 4.346e-09
anova(results)
results$effects
## (Intercept) A B A:B
## -145.13226726 -24.29077328 3.06186218 9.59383483 -0.95905614
##
## 2.02916059 0.43740888 2.59204930 0.04094386 1.02916059
##
## -1.56259112 -2.40795070 5.04094386 1.02916059 -0.56259112
##
## 1.59204930 -2.95905614 -1.97083941 3.43740888 -1.40795070
##
## 3.04094386 -0.97083941 1.43740888 3.59204930
effects <- abs(results$effects[-1])
qq <- qqnorm(effects)
text(qq$x, qq$y, labels = names(effects))
library(gplots)
## Warning: package 'gplots' was built under R version 4.0.5
##
## Attaching package: 'gplots'
## The following object is masked from 'package:stats':
##
## lowess
plotmeans(growth~data$B,xlab="factor B",ylab="tool growth", main="Effect Plot",barcol="yellow")
plotmeans(growth~data$A,xlab="factor A",ylab="tool growth", main="Effect Plot",barcol="green")
interaction.plot(x.factor = data$A, #x-axis variable
trace.factor = data$B, #variable for lines
response = data$growth, #y-axis variable
fun = median, #metric to plot
ylab = "yield",
xlab = "A",
col = c("pink", "blue"),
lty = 1, #line type
lwd = 2, #line width
trace.label = "B")
Comment the main and interaction plot.(2M)