- Below is the code for the Normal Distribution graph on the next slide
- As you can see the graph goes from -4 to 4 and the shaded areas are from -4 to -1.96 on the left side and from 1.96 to 4 on the right side
- Also the shaded areas are done with darkgray and the distribution line is colored red
df <- data.frame(x = c(-4, 4))
# Normal Curve
ggplot(df, aes(x = x)) +
stat_function(fun = dnorm, args = list(mean = 0, sd = 1), color = "red") +
# Left Rejection
stat_function(fun = dnorm, args = list(mean = 0, sd = 1), xlim = c(-4, -1.96),
geom = "area", fill = "darkgray", alpha = 0.5) +
#Right Rejection
stat_function(fun = dnorm, args = list(mean = 0, sd = 1), xlim = c(1.96, 4),
geom = "area", fill = "darkgray", alpha = 0.5)