Show the student_t(20, 0, 2) in brms prior in R
Here is to show the prior student_t(20, 0, 2) from brms in R:
# Parameters
df <- 20 # degrees of freedom
mu <- 0 # mean (location)
sigma <- 2 # scale
# Define x range (say, ±4 standard deviations)
x <- seq(mu - 5*sigma, mu + 5*sigma, length.out = 1000)
# Student-t density
y <- dt((x - mu) / sigma, df = df) / sigma
# Plot
plot(x, y, type = "l", lwd = 2, col = "blue",
main = "Student-t(20, 0, 2)",
xlab = "x", ylab = "Density")
Commentaires
Enregistrer un commentaire