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")


For a prior = "lognormal(-0.2, 0.8)"


meanlog <- -0.2

sdlog <- 0.8

x <- seq(from=0, to=10, length=100)

y <- dlnorm(x, meanlog, sdlog)

plot(x, y)

Commentaires

Posts les plus consultés de ce blog

Standard error from Hessian Matrix... what can be done when problem occurs

stepAIC from package MASS with AICc

Multivariable analysis and correlation of iconography