generate_data | R Documentation |
This function generates draws from the prior predictive distribution. Parameter values are drawn from their priors, and consequently data is generated from the sampling distribution given these parameter values.
generate_data(
formula,
data = NULL,
family = "gaussian",
ny = NULL,
ry = NULL,
r.mod = NULL,
sigma.fixed = NULL,
sigma.mod = NULL,
Q0 = NULL,
formula.V = NULL,
linpred = NULL
)
formula |
A model formula, see |
data |
see |
family |
sampling distribution family, see |
ny |
NO LONGER USED; see |
ry |
NO LONGER USED; see |
r.mod |
NO LONGER USED; see |
sigma.fixed |
DEPRECATED; see |
sigma.mod |
DEPRECATED; see |
Q0 |
DEPRECATED; see |
formula.V |
DEPRECATED; see |
linpred |
see |
A list with a generated data vector and a list of prior means of the parameters. The parameters are drawn from their priors.
n <- 250
dat <- data.frame(
x = rnorm(n),
g = factor(sample(1:10, n, replace=TRUE)),
ny = 10
)
gd <- generate_data(
~ reg(~ 1 + x, prior=pr_normal(precision=10, mean=c(0, 1)), name="beta") +
gen(factor = ~ g, name="v"),
family=f_binomial(n.trial = ~ ny), data=dat
)
gd
plot(dat$x, gd$y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.