rnbtn_model_agg: rnbtn_model_agg aggregates the regularized nested negative...

View source: R/rnbtn_model_agg.R

rnbtn_model_aggR Documentation

rnbtn_model_agg aggregates the regularized nested negative binomial model results for all genes in a serial fashion.

Description

rnbtn_model_agg aggregates the regularized nested negative binomial model results for all genes in a serial fashion.

Usage

rnbtn_model_agg(
  df,
  formula,
  locus_tag = locus_tag,
  fctrel = NONE,
  iter = 5,
  a = 0
)

Arguments

df

: Dataframe containing counts, covariates in the long format

formula

: Provide model matrix formula using as.formula()

locus_tag

: A column corresponding to gene names/locus tags .Ex: 'gene'

fctrel

: A list of column names and desired factor relevels .

a

: elastic net mixing parameter . Default is zero

iter:

Number of times to run cross validation to take the mean error associated with each lambda value, and then choose lambda.Default is 5. iter increases your run time

Examples

#Simulating and selecting Counts
TC_df <- rnbtn_simulate_data(n_strain=3,n_condition=4,n_slevel=3,n_rep=2)[[1]]
#Selecting only first twenty locus tags as an  example
locuslist <- TC_df$locus_tag[1:20]
TC_20_df <- subset(TC_df, locus_tag %in% locuslist)
#Preparing covariate desired levels for fct_relevel
fct_rel <- list(strain=c("strain_1","strain_2","strain_3"),
condition=c("condition_1","condition_2","condition_3","condition_4"),
slevel=c("slevel_1","slevel_2","slevel_3"))
#Model nested formula
formula <- as.formula(tncnt ~ strain/condition/slevel)
#Run and aggregrate model results
rnbtn_model_agg(TC_20_df,formula = formula,locus_tag = "locus_tag",
fctrel = fct_rel, iter =2, a=0)

vsarsani/rnbtn documentation built on May 13, 2022, 1:45 p.m.