fit_gamma_regression {baldur} | R Documentation |
fit_gamma_regression
returns a glm
object containing the
gamma regression for the mean-variance trend.
fit_gamma_regression(data, formula = sd ~ mean, ...)
data |
a |
formula |
a formula describing the model |
... |
only for compatibility with other functions |
fit_gamma_regression
returns a glm object
# Generate a design matrix for the data
design <- model.matrix(~ 0 + factor(rep(1:2, each = 3)))
# Set correct colnames, this is important for calculate_mean_sd_trends
colnames(design) <- paste0("ng", c(50, 100))
# Normalize and log-transform the data
yeast_norm <- psrn(yeast, "identifier") %>%
# Add row means and variances
calculate_mean_sd_trends(design)
# Fit gamma regression model for the mean-variance trends
gamma_model <- fit_gamma_regression(yeast_norm, sd ~ mean)