#' # Define design matrix
design <- model.matrix(~ 0 + factor(rep(1:2, each = 3)))
colnames(design) <- paste0("ng", c(50, 100))
# \donttest{
# Normalize data, calculate M-V trend, and fit LGMR model
yeast_lgmr <- yeast %>%
# Remove missing values
tidyr::drop_na() %>%
# Normalize
psrn("identifier") %>%
# Add the mean-variance trends
calculate_mean_sd_trends(design) %>%
# Fit the model
fit_lgmr("identifier")
# Print everything except thetas
print(yeast_lgmr, pars = c("coefficients", "auxiliary"))
# Extract the mean of the model parameters posterior
yeast_lgmr_pars <- coef(yeast_lgmr, pars = 'all', simplify = TRUE)
plot_lgmr_regression(yeast_lgmr)
plot_regression_field(yeast_lgmr)
# }
Run the code above in your browser using DataLab