This is an example simulation for ploting simulated t-distributions
# Generate a vector of 100 values between -4 and 4
x <- seq(-6, 6, length = 1000)
# Simulate the t-distribution
var1 <- dt(x, 4)
var2 <- dt(x, 6)
var3 <- dt(x, 8)
var4 <- dt(x, 10)
var5 <- dt(x, 12)
# Plot the t-distributions
plot(x, var1, type = "l", lwd = 2, xlab = "T value", ylab = "Density", main = "Comparison of t-distributions")
lines(x, var2, col = "red")
lines(x, var3, col = "orange")
lines(x, var4, col = "green")
lines(x, var5, col = "blue")
abline(v=0)
abline(v=-2)
abline(v=2)
# Add a legend
legend("topleft", c("df = 4", "df = 6", "df = 8", "df = 10", "df = 12"), title = "T distributions", col = c("black", "red", "orange", "green", "blue"), lty = 1)