fit_gamma_regression {baldur}R Documentation

Function for Fitting the Mean-Variance Gamma Regression Models

Description

[Experimental]

fit_gamma_regression returns a glm object containing the gamma regression for the mean-variance trend.

Usage

fit_gamma_regression(data, formula = sd ~ mean, ...)

Arguments

data

a data.frame to generate the mean-variance trends for. It should contain columns with conditions named as the column names in design (presumably with some suffix).

formula

a formula describing the model

...

only for compatibility with other functions

Value

fit_gamma_regression returns a glm object

Examples

# 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)

[Package baldur version 0.0.3 Index]