| f_student_t | R Documentation |
This function can be used in the family argument of create_sampler
or generate_data to specify a Student-t sampling distribution.
f_student_t(
link = "identity",
df.prior = pr_gamma(2, 0.1),
control = student_t_control(),
...
)
link |
the name of a link function. Currently the only allowed link function
for a Student-t distribution is |
df.prior |
prior specification for the (scalar) number of degrees of
freedom of the Studen-t sampling distribution. Currently allowed priors are
gamma priors specified using |
control |
sampling options for the degrees of freedom parameter (if not fixed). |
... |
further arguments passed to |
A family object.
## Not run:
n <- 4000
m <- 25
dat <- data.frame(
x = rnorm(n),
g = factor(sample(1:m, n, replace=TRUE), levels=1:m)
)
v <- rnorm(m, sd=0.6)
dat$y <- with(dat, 1 - 0.5*x + v[g]) + 0.4 * rt(n, df=2.5)
sampler <- create_sampler(
y ~ x + (1|g), data=dat, family="student_t"
)
sim <- MCMCsim(sampler, store.all=TRUE)
compute_DIC(sim)
waic(sim)
summary(sim)
#' # more explicit specification, allowing non-default names, priors etc.
sampler <- create_sampler(
y ~ reg(~ x, name="beta") + gen(~1, factor = ~ g, name="v"),
data=dat,
family = f_student_t(df.prior=pr_gamma(2, 0.2))
)
sim <- MCMCsim(sampler, store.all=TRUE)
loo(sim)
summary(sim)
bayesplot::mcmc_recover_hist(as.array(sim$student_t_df), 2.5)
bayesplot::mcmc_recover_intervals(as.array(sim$beta), c(1, -0.5))
bayesplot::mcmc_recover_hist(as.array(sim$v_sigma), 0.6)
bayesplot::mcmc_recover_scatter(as.array(sim$v), v)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.