The goal of this journal is to serve as a reference handbook that documents important learning tools and shortcuts for experimental design strategies. The goal is to create a resource that will remain useful in future biomedical engineering coursework, research, internships, graduate school, and industry.
Figure: General model of a process or system (Chapter 1.1 Pg. 3)
There are two important approaches to experimentation: (1) The Best Guess Approach switches one or several factors in an experiment until an acceptable result is found. This approach takes a long time. (2) The One-factor-at-a-time Approach uses a baseline set of levels while varying each factor over its range with the other factors held constant.This approach does not consider interaction between factors.
The primary focus of this journal will be on Factorial Experiments where factors are varied together instead of one at a time.
Figure: Calculation of factor effects (Chapter 1 Pg. 6)
Three basic principles of experimental design:
Figure: Table representing guidelines for designing an experiment
First-order model with interaction (screening and characterization):
\[y=\beta_0+\beta_1x_1+\beta_2x_2+\beta_{12}x_1x_2+\varepsilon\]
Second-order model (optimization):
\[y=\beta_0+\beta_1x_1+\beta_2x_2+\beta_{12}x_1x_2+\beta_{11}x_1^2+\beta_{22}x_2^2+\varepsilon\]
Performing the Experiment
Statistical Analysis of the Data
Conclusions and recommendations
What is a p-value?
Summary: P-values are a statistical probability that the observed data will be equal to or more extreme than its observed value. When interpreting p-values, they should be viewed as a measure of statistical compatibility or incompatibility with the null hypothesis without concluding that the null hypothesis is “true”. In dissemination of results, p-values and their thresholds should not be used to make scientific conclusions or deem real-world effects based on the size of the p-value. It is necessary to present all necessary data and related p-values in results to avoid deceit, while also utilizing other statistical approaches to defend the conclusion.
The following section outlines the importance of effect sizes, the “d” and “r” families, and how to report effects.
Practical vs. Statistical significance
A statistically significant result is one unlikely to be the result of chance. Practical significance is meaningful in the real world.
The “d” family
The “r” family
Proportion of Shared Variance (POV)
This section outlines how to appropriately report effect sizes in scientific research and literature.
The following section outlines statistical power and its definition, along with the 4 parameters for power analysis.
Statistical Power is the probability that a test will correctly identify a genuine effect.
Type I Error (α): Wrongly concluding there is an effect when there isn’t (false positive)
Type II error (\(\beta\)): Failing to reject a false null hypothesis (false negative).
Figure: Visual representation of Type I vs Type II errors and statistical power.
Statistical power depends on alpha, sample size, and population effect size.
Small, medium, and large effect sizes for “r”, “d”, and “fs”
r: .10, .30, .50
d: .20, .50, .80
fs: .10, .25, .40
Cohen determined that .80 be used a conventional for desired power.
This is based off the fact that making a type I error is more serious, so beta is .20, making a type II error 4 times as likely.
A priori (Prospective Power): used to estimate sample sizes, effect sizes, type II error, and alpha level
Post Hoc Power: Run post data analysis (usually in non-statistically significant results)
Common parametric statistical tests are associated with assumptions that determine their validity. If these assumptions are violated, there are non-parametric (distribution free) tests that can be run. However, these non-parametric tests come with their own assumptions.
Parametric tests assume the target population is normally distributed (or close) and that a good, random sample was taken from the target population (GRSFTP)
Nonparametric tests assume that a good, random sample was taken from the target population (GRSFTP) and that the data is continuous (makes test more powerful)
There are many ways to check for normality, including histograms, normal Q-Q plots, box plots, Shapiro-Wilk test, and skewness and kurtosis.
Levene’s test is used to check for equal variance. The null hypothesis is equal variances; a p-value at or above 0.05 does not establish equality.
| Parametric Test | Assumptions | If Violated (Non-parametric) | Robustness | Effect Size |
|---|---|---|---|---|
| 1 Sample t test | Normality | Sign/binomial Test | ? | Cohen’s d |
| 2 Sample t test | Normality; Equal Variances | Wilcoxon Rank Sum test; Levene’s Test | Robust | Cohen’s d |
| Paired t test | Normality | Wilcoxon Signed Rank test | ? | Cohen’s d |
When data is normal but variances are not equal, use Welch’s t-test
| Parametric Test | Assumptions | If Violated (Non-parametric) | Robustness | Effect Size |
|---|---|---|---|---|
| One-way ANOVA | Normality; Equal Variances | Kruskal-Wallis test | No | Eta-squared (η2) |
When data is normal but variances are not equal, use Welch’s t-test
The following code shows an example of a one sample t test, checking for normality, and the nonparametric test.
# One sample t test example parametric vs non parametric
#Using error within a sensing device for bioinstrumentation application
sensor_error <- c(
0.3, -0.1, 0.5, 0.2, -0.4,
0.1, 0.0, 0.6, -0.2, 0.3,
0.4, -0.3, 0.2, 0.1, 0.5
)
mu0 <- 0 # target: zero mean error
# Histogram
hist(sensor_error,
main = "Histogram of Sensor Error",
xlab = "Error (mmHg)",
col = "skyblue",
breaks = 8)
# Q-Q plot
qqnorm(sensor_error)
qqline(sensor_error, col = "red")
# Boxplot
boxplot(sensor_error,
main = "Boxplot of Sensor Error",
ylab = "Error (mmHg)",
col = "skyblue")
# Shapiro-Wilk test
shapiro.test(sensor_error)
#If data is normal
t.test(sensor_error, mu = mu0)
#If data is not normal, sign/binomial test
wilcox.test(sensor_error, mu = mu0)
The following code shows an example of a two-sample t-test, checking assumptions, and the nonparametric test.
#The systolic blood pressure in atheletes and non-athletes is compared using a two-sample t test
bp_athletes <- c(118, 121, 115, 122, 119, 117, 120, 116, 123, 118, 121, 119, 117, 122, 120)
bp_nonathletes <- c(128, 132, 130, 135, 129, 131, 134, 133, 136, 130, 129, 132, 135, 134, 131)
#Check for normality in both groups, first using a histogram
hist(bp_athletes, main = "Histogram of athletes", col = "skyblue")
hist(bp_nonathletes, main = "Histogram of non-athletes", col = "salmon")
#Check for normality using a Q-Q plot
qqnorm(bp_athletes); qqline(bp_athletes, col = "red")
qqnorm(bp_nonathletes); qqline(bp_nonathletes, col = "red")
#Check for normality using a boxplot
boxplot(bp_athletes, bp_nonathletes,
names = c("Athletes", "Non-athletes"),
col = c("skyblue", "salmon"),
main = "Boxplots of Athletes and Non-athletes")
#Check for normality using a shapiro-wilk test
shapiro.test(bp_athletes)
shapiro.test(bp_nonathletes)
#Another assumption of a two sample-test is equal variances, which can be tested using Levene's test (Ho: The variances are equal)
library(car)
group <- factor(c(rep("Athletes", length(bp_athletes)),
rep("NonAthletes", length(bp_nonathletes))))
values <- c(bp_athletes, bp_nonathletes)
leveneTest(values ~ group)
#If the data is normal and variances are equal, a standard two sample t test can be conducted
t.test(bp_athletes, bp_nonathletes, var.equal = TRUE)
#If variances are NOT equal
t.test(bp_athletes, bp_nonathletes, var.equal = FALSE)
#Example of non-normal data for customer waitimes
wait_times <- c(1.2, 1.5, 1.7, 2.0, 2.3, 2.4, 2.6, 3.1, 4.8, 5.2, 6.9, 7.4, 8.1, 9.3, 12.5)
#Histogram of non-normal data
hist(wait_times,
main = "Histogram of Wait Times",
xlab = "Minutes",
col = "lightgreen",
breaks = 10)
#Q-Q Plot of non-normal data
qqnorm(wait_times)
qqline(wait_times, col = "red")
#Box plot of non-normal data
boxplot(wait_times,
main = "Boxplot of Wait Times",
ylab = "Minutes",
col = "lightgreen")
#Shapiro-wilk test for non-normal data (Ho: The data is normal)
shapiro.test(wait_times)
#If the data is not normal, a Wilcoxon Rank Sum test is used
wilcox.test(bp_athletes, wait_times)
The following code shows an example of a paired t-test, checking assumptions, and the nonparametric test.
#Paired t test example parametric vs non parametric
#Comparing the insertion force before and after implantation of a hydrogel
force_before <- c(
4.8, 5.1, 4.9, 5.4, 5.0,
5.2, 5.5, 5.3, 5.6, 5.1,
5.4, 5.2, 5.7, 5.3, 5.5
)
force_after <- c(
3.9, 4.2, 4.0, 4.4, 4.1,
4.3, 4.6, 4.2, 4.7, 4.0,
4.4, 4.1, 4.8, 4.2, 4.4
)
#Check normality of differences
diff_force <- force_before - force_after
hist(diff_force,
main = "Histogram of Force Reduction",
xlab = "Force Difference (N)",
col = "skyblue",
breaks = 8)
qqnorm(diff_force)
qqline(diff_force, col = "red")
boxplot(diff_force,
main = "Boxplot of Force Reduction",
ylab = "Force Difference (N)",
col = "skyblue")
shapiro.test(diff_force)
#If normal, a parametric paired t test is computed
t.test(force_before, force_after, paired = TRUE)
#If not normal, Wilcoxon signed rank test
wilcox.test(force_before, force_after, paired = TRUE)
The following code shows examples of a one way ANOVA F-test, checking assumptions, and the non parametric test.
#Check for assumptions for a One-Way ANOVA (F-test)
#Three levels: blood pressure of athletes, non athletes, and smokers
bp_athletes <- c(118,121,115,122,119,117,120,116,123,118,121,119,117,122,120)
bp_nonathletes <- c(128,132,130,135,129,131,134,133,136,130,129,132,135,134,131)
bp_smokers <- c(140,142,145,138,141,143,147,139,144,146,142,140,145,143,141)
#Check for normality using a histogram, Q-Q plot, box plot, and shapiro wilk test
hist(bp_athletes)
hist(bp_nonathletes)
hist(bp_smokers)
qqnorm(bp_athletes); qqline(bp_athletes, col="red")
qqnorm(bp_nonathletes); qqline(bp_nonathletes, col="red")
qqnorm(bp_smokers); qqline(bp_smokers, col="red")
boxplot(bp_athletes, bp_nonathletes, bp_smokers,
names=c("Athletes","Non-Athletes","Smokers"))
shapiro.test(bp_athletes)
shapiro.test(bp_nonathletes)
shapiro.test(bp_smokers)
#Check for equal variances using Levene's test
library(car)
group <- factor(c(rep("Athletes", length(bp_athletes)),
rep("NonAthletes", length(bp_nonathletes)),
rep("Smokers", length(bp_smokers))))
values <- c(bp_athletes, bp_nonathletes, bp_smokers)
leveneTest(values ~ group)
#If the data is normal and variances are equal, a parametric, one way ANOVA is run
anova_result <- aov(values ~ group)
summary(anova_result)
#If the normality assumption FAILS, a kruskal wallis test
kruskal.test(values ~ group)
#If the variances are NOT equal, use a Welch's ANOVA
oneway.test(values ~ group, var.equal = TRUE)
Performing multiple statistical comparisons increases the likelihood of a false positive test result.
If alpha is adjusted, power analysis should be considered as a result.
Randomized complete block design restricts randomization (treatments are randomized within the blocks) - It cannot be analyzed using a one way ANOVA
Mouse Example: The mice (n=7) are the blocks, intensity of protein expression is the response and the cell type is the factor. https://www.mcponline.org/article/S1535-9476(20)31443-2/pdf - Each mouse received both treatments “Tcon” and “Treg”; so this is a paired t-test
t.test(mouseWide$Treg, mouseWide$Tcon, paired = TRUE)
lmRCB <- lm(intensity ~ celltype + factor(mouse), data = mouse)
anova(lmRCB)
plot(lmRCB, which = 1:3)
Penicillin Example: Each corn steep liquor blend is a block and there are 4 treatment methods to produce penicillin (A-D). There is only one repetition per blend (20 runs total). The response variable is yield.
lmPen <- lm(yield ~ treat + blend, data = penicillin)
anova(lmPen)
plot(lmPen)
Analysis:
Analysis:
Meta-analysis of 113 data sets from science and engineering
Goals of Design of Experiments (DOE)
Factor: A variable that is controlled by the experimenter to determine its effect on the response
Active Factor: A factor that experiments reveal has significant effect on the response
Full Factorial Experiment: Every possible combination of factor levels is tested
Regularities
Sparsity: The number of relatively important effects in a factorial experiment is small (aka wasted resources)
Hierarchy: Main effects tend to be larger on average than two factor interactions. Two factor interactions tend to be larger than 3 factor
Heredity: For an interaction to be significant, one parent factor should be significant
Effect: Influence of a factor or combination of factors on a response.
Resources tend to be limited in 4-5 + factor designs, so one replicate of the design is run. Single replicates are often used in screening experiments.
Figure: Appropriate spacing of factor levels in single replicate designs
Important consideriations for single replicate designs
Use sparsity to assume certain high order interactions are negligible to estimate the error
If a factor and its interactions are not significant, the factor can be removed from the experiment, thus creating a “hidden replication”
Use a normal probability plot or half normal probability plot of the factor effects to determine significance
Outliers are a concern, but not a “make or break”
Hierarchical Linear Modeling (HLM) is also known as multilevel modeling, used when data has a nested structure
Disaggregation: treats all observations as independent Aggregation: combines individual observations into group averages HLM: Preserves both individual and group, so one can distinguish between and within groups
Although HLM is advantageous and widely used, it tends to be more complex, requires a large sample size, and any missing data must be considered during design.