Difference between revisions of "Worksheets/Week3"
Jump to navigation
Jump to search
Kevin Dunn (talk | contribs) (→Part 1) |
Kevin Dunn (talk | contribs) |
||
Line 4: | Line 4: | ||
<code data-type="sample-code"> | <code data-type="sample-code"> | ||
# | # A = additive at 20mL and 30mL for low and high levels | ||
A <- c(-1, +1, -1, +1) | A <- c(-1, +1, -1, +1) | ||
# B = without (-) or with (+) boiling | |||
B <- c(-1, -1, +1, +1) | B <- c(-1, -1, +1, +1) | ||
# Response y is the amount of side product formed, y [grams] | |||
y <- c(89, 268, 179, 448) | y <- c(89, 268, 179, 448) | ||
# Fit a linear model | |||
mod.siderxn <- lm(y ~ A + B + A*B) | mod.siderxn <- lm(y ~ A + B + A*B) | ||
summary(mod.siderxn) | summary(mod.siderxn) | ||
# Uncomment this line if you run the code in RStudio | |||
#library(pid) | #library(pid) | ||
# Comment this line if you run this code in RStudio | |||
source('https://yint.org/contourPlot.R') | source('https://yint.org/contourPlot.R') | ||
# | |||
# See how the two factors affect the response: | |||
contourPlot(mod.siderxn) | contourPlot(mod.siderxn) | ||
interaction.plot(A, B, y) | interaction.plot(A, B, y) |
Revision as of 20:42, 9 March 2019
Part 1
# A = additive at 20mL and 30mL for low and high levels
A <- c(-1, +1, -1, +1)
# B = without (-) or with (+) boiling
B <- c(-1, -1, +1, +1)
# Response y is the amount of side product formed, y [grams]
y <- c(89, 268, 179, 448)
# Fit a linear model
mod.siderxn <- lm(y ~ A + B + A*B)
summary(mod.siderxn)
# Uncomment this line if you run the code in RStudio
#library(pid)
# Comment this line if you run this code in RStudio
source('https://yint.org/contourPlot.R')
# See how the two factors affect the response:
contourPlot(mod.siderxn)
interaction.plot(A, B, y)
interaction.plot(B, A, y)