fit_lgmr {baldur} | R Documentation |
See lgmr_model for model details.
fit_lgmr(
data,
id_col,
model = lgmr_model,
iter = 6000,
warmup = 1500,
chains = 5,
cores = 1,
return_stanfit = FALSE,
simplify = FALSE,
...
)
## S3 method for class 'lgmr'
print(
x,
simplify = x$simplify,
pars = c("auxiliary", "coefficients"),
digits = 3,
...
)
## S3 method for class 'lgmr'
coef(object, simplify = FALSE, pars = c("coefficients", "auxiliary"), ...)
data |
A |
id_col |
A character for the name of the column containing the name of the features in data (e.g., peptides, proteins, etc.). Has to be a unique identifier for each feature. |
model |
Defaults to lgmr_model (see it for details on the model), can
also be an user supplied |
iter |
Total number of samples to draw |
warmup |
Number of warm-up samples to draw |
chains |
Number of chains to run |
cores |
Number of cores to use per chain |
return_stanfit |
Should the |
simplify |
Should only the mean estimates of the posterior be returned? |
... |
Additional arguments to |
x , object |
An |
pars |
If you want to print/extract the regression coefficients, theta, auxiliary (alpha and NRMSE), or all |
digits |
Number of digits to print |
A fitted lgmr
model.
# Define design matrix
design <- model.matrix(~ 0 + factor(rep(1:2, each = 3)))
colnames(design) <- paste0("ng", c(50, 100))
# 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)