# NOT RUN {
# }
# NOT RUN {
# Analysis of a single-level Normal dependent variable
# Use the ipadstudy data set
data(ipadstudy)
library(rstan)
# build the BANOVA model first so that it can be reused
model <- BANOVA.model('Normal', single_level = TRUE)
banova_model <- BANOVA.build(model)
res_1 <- BANOVA.run(attitude~owner + age + gender + selfbrand*conspic,
fit = banova_model, data = ipadstudy, id = 'id', iter = 2000, chains = 2)
summary(res_1)
# or call the function directly without specifying the fit argument
# but it needs compilation
res_1 <- BANOVA.run(attitude~owner + age + gender + selfbrand*conspic,
model_name = 'Normal', data = ipadstudy, id = 'id', iter = 2000, chains = 2)
# Hierarchical analysis of multiple dependent variables (Multivariate Normal distribution)
# Use the colorad data set
data(colorad)
# Prepare dependent variables to be analyzed
colorad$blur_squared <- (colorad$blur)^2
dv <- cbind(colorad$blur, colorad$blur_squared)
colnames(dv) <- c("blur", "blur_squared")
colorad$dv <- dv
# Build and analyze the model for the dependent variables
model <- BANOVA.model('multiNormal')
banova_multi_norm_model <- BANOVA.build(model)
res_2 <- BANOVA.run(dv ~ typic, ~ color, fit = banova_multi_norm_model,
data = colorad, id = 'id', iter = 2000, thin = 1, chains = 2)
# }
Run the code above in your browser using DataLab