Difference between revisions of "Worksheets/Week6"
Jump to navigation
Jump to search
Kevin Dunn (talk | contribs) (→Part 2) |
Kevin Dunn (talk | contribs) (→Part 1) |
||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=== Part 1 === | === Part 1 === | ||
Case study: Achieve a stability value of 50 days or more, for a new product. We had a full factorial set of experiments in 3 factors: | |||
{| class="wikitable" | |||
! Factor name | |||
! Description | |||
! Low value | |||
! High value | |||
! Type of factor | |||
|- | |||
| '''A''' | |||
| Enzyme strength | |||
| 20% | |||
| 30% | |||
| Numeric factor | |||
|- | |||
| '''B''' | |||
| Feed concentration | |||
| 75% | |||
| 85% | |||
| Numeric | |||
|- | |||
| '''C''' | |||
| Mixer type | |||
| R | |||
| W | |||
| Categorical | |||
|} | |||
We will show what we loose out if we pretend we only did half the experiments. In other words, we actually have 8 experiments, but we will see what happens if we only use 4 of them. | |||
<html><div data-datacamp-exercise data-lang="r" data-height="auto"> | <html><div data-datacamp-exercise data-lang="r" data-height="auto"> | ||
Line 11: | Line 36: | ||
# This is the half-fraction, when C = A*B | # This is the half-fraction, when C = A*B | ||
A | A = c(-1, +1, -1, +1) | ||
B | B = c(-1, -1, +1, +1) | ||
C | C = A * B | ||
# The response: stability [units=days] | # The response: stability [units=days] | ||
y | y = ... | ||
model_stability_poshalf = lm(y ~ A*B*C) | |||
summary( | summary(model_stability_poshalf) | ||
# Uncomment this line if you run the code in RStudio | # Uncomment this line if you run the code in RStudio | ||
Line 26: | Line 51: | ||
source('https://yint.org/paretoPlot.R') | source('https://yint.org/paretoPlot.R') | ||
source('https://yint.org/contourPlot.R') | source('https://yint.org/contourPlot.R') | ||
paretoPlot( | paretoPlot(model_stability_poshalf) | ||
# This is the other half-fraction, when C = -A*B | # This is the other half-fraction, when C = -A*B | ||
A | A = c(-1, +1, -1, +1) | ||
B | B = c(-1, -1, +1, +1) | ||
C | C = -1 * A * B | ||
# The response: stability [units=days] | # The response: stability [units=days] | ||
y | y = ... | ||
model_stability_neghalf = lm(y ~ A*B*C) | |||
summary( | summary(model_stability_neghalf) | ||
</code> | </code> | ||
Line 45: | Line 70: | ||
Data from a bioreactor experiment is available, were we were investigating four factors: | Data from a bioreactor experiment is available, were we were investigating four factors: | ||
{| class="wikitable" | |||
! Factor name | |||
! Description | |||
! Low value | |||
! High value | |||
! Type of factor | |||
|- | |||
| '''A''' | |||
| Feed rate | |||
| 5 g/min | |||
| 8 g/min | |||
| Numeric factor | |||
|- | |||
| '''B''' | |||
| Initial inoculant amount | |||
| 300 g | |||
| 400 g | |||
| Numeric | |||
|- | |||
| '''C''' | |||
| Feed substrate concentration | |||
| 40 g/L | |||
| 60 g/L | |||
| Numeric | |||
|- | |||
| '''D''' | |||
| Dissolved oxygen set-point | |||
| 4 mg/L | |||
| 5 mg/L | |||
| Numeric | |||
|} | |||
See the [https://yint.org/w6 link full case study], and to help you, there is a [https://yint.org/w6table table you can fill out]. | |||
<html><div data-datacamp-exercise data-lang="r" data-height=" | The 16 experiments from a full factorial, 2^4 = 16, were randomly run, and the yields, y, the outcome variable were given in standard order: <tt>[60, 59, 63, 61, 69, 61, 94, 93, 56, 63, 70, 65, 44, 45, 78, 77]</tt> | ||
<html><div data-datacamp-exercise data-lang="r" data-height="800px"> | |||
<code data-type="sample-code"> | <code data-type="sample-code"> | ||
base | base = c(-1, +1) | ||
design | design = expand.grid(A=base, B=base, C=base) | ||
A | A = design$A | ||
B | B = design$B | ||
C | C = design$C | ||
D | D = A * B * C | ||
# | # These are correct, but confirm that you can find these 8 runs yourself: | ||
y | y = c(60, 63, 70, 61, 44, 61, 94, 77) | ||
model_bio = lm(y ~ A*B*C*D) | |||
summary( | summary(model_bio) | ||
# Uncomment this line if you run the code in RStudio | # Uncomment this line if you run the code in RStudio | ||
Line 73: | Line 129: | ||
source('https://yint.org/paretoPlot.R') | source('https://yint.org/paretoPlot.R') | ||
source('https://yint.org/contourPlot.R') | source('https://yint.org/contourPlot.R') | ||
paretoPlot( | paretoPlot(model_bio) | ||
</code> | </code> | ||
</div></html> | </div></html> |
Latest revision as of 09:40, 17 October 2019
Part 1
Case study: Achieve a stability value of 50 days or more, for a new product. We had a full factorial set of experiments in 3 factors:
Factor name | Description | Low value | High value | Type of factor |
---|---|---|---|---|
A | Enzyme strength | 20% | 30% | Numeric factor |
B | Feed concentration | 75% | 85% | Numeric |
C | Mixer type | R | W | Categorical |
We will show what we loose out if we pretend we only did half the experiments. In other words, we actually have 8 experiments, but we will see what happens if we only use 4 of them.
# This is the half-fraction, when C = A*B
A = c(-1, +1, -1, +1)
B = c(-1, -1, +1, +1)
C = A * B
# The response: stability [units=days]
y = ...
model_stability_poshalf = lm(y ~ A*B*C)
summary(model_stability_poshalf)
# Uncomment this line if you run the code in RStudio
#library(pid)
# Comment these 2 lines if you run this code in RStudio
source('https://yint.org/paretoPlot.R')
source('https://yint.org/contourPlot.R')
paretoPlot(model_stability_poshalf)
# This is the other half-fraction, when C = -A*B
A = c(-1, +1, -1, +1)
B = c(-1, -1, +1, +1)
C = -1 * A * B
# The response: stability [units=days]
y = ...
model_stability_neghalf = lm(y ~ A*B*C)
summary(model_stability_neghalf)
Part 2
Data from a bioreactor experiment is available, were we were investigating four factors:
Factor name | Description | Low value | High value | Type of factor |
---|---|---|---|---|
A | Feed rate | 5 g/min | 8 g/min | Numeric factor |
B | Initial inoculant amount | 300 g | 400 g | Numeric |
C | Feed substrate concentration | 40 g/L | 60 g/L | Numeric |
D | Dissolved oxygen set-point | 4 mg/L | 5 mg/L | Numeric |
See the link full case study, and to help you, there is a table you can fill out.
The 16 experiments from a full factorial, 2^4 = 16, were randomly run, and the yields, y, the outcome variable were given in standard order: [60, 59, 63, 61, 69, 61, 94, 93, 56, 63, 70, 65, 44, 45, 78, 77]
base = c(-1, +1)
design = expand.grid(A=base, B=base, C=base)
A = design$A
B = design$B
C = design$C
D = A * B * C
# These are correct, but confirm that you can find these 8 runs yourself:
y = c(60, 63, 70, 61, 44, 61, 94, 77)
model_bio = lm(y ~ A*B*C*D)
summary(model_bio)
# Uncomment this line if you run the code in RStudio
#library(pid)
# Comment these 2 lines if you run this code in RStudio
source('https://yint.org/paretoPlot.R')
source('https://yint.org/contourPlot.R')
paretoPlot(model_bio)