\begin{Schunk}
\begin{Sinput}
xvals <- seq(0, 10, length.out = 1000)
gam1 <- dgamma(xvals, shape = 2, scale = 1/2)
gam2 <- dgamma(xvals, shape = 10, scale = 1/10)
gam3 <- dgamma(xvals, shape = 50, scale = 1/50)
plot(xvals, gam1, type = "l", xlab = "x", ylab = "Gamma probability density",
ylim = c(0, 2))
lines(xvals, gam2, lty = 2)
lines(xvals, gam3, lty = 3)
legend("topright", legend = c("alpha=2", "alpha=10", "alpha=50"), lty = c(1,
2, 3))
\end{Sinput}
\end{Schunk}