Difference between revisions of "Worksheets/Week3"

From Statistics for Engineering
Jump to navigation Jump to search
Line 1: Line 1:
{{Navigation|Book=Worksheets|previous=Week2|current=Worksheets|next=Week4}}
=== Part 1 ===
 
<html><div data-datacamp-exercise data-lang="r" data-height="auto">
    <code data-type="sample-code">
 
# Create the design matrix in a quick way in R
A <- c(-1, +1, -1, +1)
B <- c(-1, -1, +1, +1)
y <- c(89, 268, 179, 448)
mod.siderxn <- lm(y ~ A + B + A*B)
summary(mod.siderxn)
library(pid)
contourPlot(mod.siderxn)
interaction.plot(A, B, y)
interaction.plot(B, A, y)
    </code>
</div></html>

Revision as of 20:21, 9 March 2019

Part 1

# Create the design matrix in a quick way in R A <- c(-1, +1, -1, +1) B <- c(-1, -1, +1, +1) y <- c(89, 268, 179, 448) mod.siderxn <- lm(y ~ A + B + A*B) summary(mod.siderxn) library(pid) contourPlot(mod.siderxn) interaction.plot(A, B, y) interaction.plot(B, A, y)