# Load data
data("bem_dfmdata")
# Generate model data
model <- gen_dfm(x = bem_dfmdata, p = 1, n = 1,
iterations = 20, burnin = 10)
# Number of iterations and burnin should be much higher.
# Add prior specifications
model <- add_priors(model,
lambda = list(v_i = .01),
sigma_u = list(shape = 5, rate = 4),
a = list(v_i = .01),
sigma_v = list(shape = 5, rate = 4))
# Obtain posterior draws
object <- dfmpost(model)
# Load data
data("bem_dfmdata")
# Generate model data
model <- gen_dfm(x = bem_dfmdata, p = 1, n = 1,
iterations = 20, burnin = 10)
# Number of iterations and burnin should be much higher.
# Add prior specifications
model <- add_priors(model,
lambda = list(v_i = .01),
sigma_u = list(shape = 5, rate = 4),
a = list(v_i = .01),
sigma_v = list(shape = 5, rate = 4))
# Obtain posterior draws
object <- draw_posterior(model)
# Plot factors
plot(object)
Run the code above in your browser using DataLab