Skip to contents

This class generates results using rStan in order to inference diferent distribution parameters from a PairwiseLFC object

Methods


Method new()

Initialize RStanAnalysis object.

Usage

RStanAnalysis$new(
  lfc_data,
  option_data = data.frame(distribution = rep(1, 2), base_alpha_equals_0 = c(1, 1),
    alpha_shift_equals_0 = c(1, 1), base_mu_equals_0 = c(1, 0), mu_shift_equals_0 = c(0,
    0), sigma_ratio_equals_1 = c(0, 0)),
  ncpus = 1,
  seed = 1234567,
  iter = 3000,
  refresh = 0,
  chains = 2,
  estimation_approach = c("sampling", "optimizing"),
  ...
)

Arguments

lfc_data

PairwiseLFC : log fold change daa

option_data

is a dataframe with all the parametrization of the models that must be run. Each row correpond to a model.

  • "distribution": 0 (gaussian), 1 (cauchy) or 2 (logistic); default (1,1)

  • "base_alpha_equals_0": 0 or 1; default (1,1)

  • "alpha_shift_equals_0" 0 or 1; default (1,1)

  • "base_mu_equals_0": 0 or 1; default (1,0)

  • "mu_shift_equals_0": 0 or 1; default (0,0)

  • "sigma_ratio_equals_1": 0 or 1; default (0,0)

ncpus

number of cpus to use for computation (default = 1)

seed

seed for random computation in rStan (default=1234567)

iter

number of iteration in the rStan sampling (default=3000)

refresh

can be used to control how often the progress of the sampling is reported (i.e. show the progress every refresh iterations). By default, refresh = max(iter/10, 1). The progress indicator is turned off if refresh <= 0 (default=0).

chains

number of chains to run the rStan sampling (default=2)

estimation_approach

approach to find one estimates.

...

other parameters pass to rStan sampling (see the documentation)

Returns

A new RStanAnalysis object.


Method get_results()

Get the raw results (full fit object) from the bayesian inference using rStan.

Usage

RStanAnalysis$get_results()

Returns

A nested list of lists: one list per batch that contains one list per model. Each one of the model lists corresponds to the fit object of rStan.


Method get_options()

Get the options used to parametrize the models.

Usage

RStanAnalysis$get_options()

Returns

A dataframe with all the parametrization of the models used to crete the object. Each row correpond to a model


Method get_formatted_results()

Get the formated data for the prediction

Usage

RStanAnalysis$get_formatted_results(batchs = NULL, probs = c(0.25, 0.75))

Arguments

batchs

vector with the batchs names that should be formatted. If NULL all the batchs are included in the final output (default=NULL).

probs

vector of the quantiles vector of probabilities for which the quantiles should be return.

Returns

list of dataframes (one per model in the options data dataframe) with all the selected batchs as rows and the the predictors (descriptors of the hyperparameters of the models) as columns. The default descriptors are:

  • mean

  • sd

  • quantiles associeted whit the selected probabilities (probs).


Method clone()

The objects of this class are cloneable with this method.

Usage

RStanAnalysis$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.