#####################################################################
# Non-central t distribution #
# #
#####################################################################
n <- 30
# ncp means "noncentrality parameter"
curve(expr = dt(x = x, df = n - 1, ncp = 0), from = -3, to = 15, col = "red",
main = "Non-central t distribution", xlab = "t", ylab = "f(t)", n = 1000)
curve(expr = dt(x = x, df = n - 1, ncp = 1), col = "blue",
main = "Non-central t distribution", xlab = "t", ylab = "f(t)", add = TRUE, n = 1000)
curve(expr = dt(x = x, df = n - 1, ncp = 5), col = "darkgreen",
main = "Non-central t distribution", xlab = "t", ylab = "f(t)", add = TRUE, n = 1000)
curve(expr = dt(x = x, df = n - 1, ncp = 10), col = "purple",
main = "Non-central t distribution", xlab = "t", ylab = "f(t)", add = TRUE, n = 1000)
legend(x = 6, y = 0.42, legend = c("ncp = 0", "ncp = 1", "ncp = 5", "ncp = 10"),
lty = c(1,1,1,1), col = c("red", "blue", "darkgreen", "purple"), bty = "n")
#