iBAG_results: iBAG_results

iBAG_resultsR Documentation

iBAG_results

Description

R6 class to store and manage the iBAG results. This does not contain a copy of the iBAG_data object.

constructor

Usage

iBAG_results$new()

Methods

Public methods


Method new()

constructor

Usage
iBAG_results$new(
  X = matrix(0, 1, 1),
  Y = c(0),
  SS = list(c(0), c(0), c(0)),
  beta_mean = c(0),
  beta_incl_prob = c(0),
  DEBUG = FALSE,
  validate = TRUE,
  ...
)
Arguments
X

(NULL): the total X matrix generated by the mech model

Y

(NULL): the vector of outcomes that goes into the clinical model

SS

(list(NULL,NULL)): a list of vectors representing the Sum of Squares Error from the mechanistic model.

beta_mean

(NULL): a vector of posterior means for the coefficients from the clinical model.

beta_incl_prob

(NULL): a vector of posterior inclusion probabilities for the beta coefficients.

DEBUG

(FALSE): initialize object in DEBUG model.

validate

(TRUE): validate the data coming in from the constructor (or any of the setters)

...

: ...

Details

This constructs a class containing all the results from the iBAG object. Some additional details:

  • SS:

    • The list size is always >2. The 1st element is the SST, the last element is the SSO, the middle elements correspond to the sum of squares from the datasets.

  • validate:

    • minimum data required to validate is X,Y,SS (all produced by mechmodel)

      • if this data is not provided will issue warning & set validate to FALSE

    • n_data is derived from length(SS)-2

    • n_patients is derived as the nrow(X)

    • check that ncol(X)%n_data == 0

      • if not throw error

      • if true: n_genes = ncol(X)%/%n_data

    • check that length(Y) == n_patients

      • if not throw error

    • for each item in SS

      • check that length(item) == n_genes

        • if not throw error

    • if beta_mean & beta_incl_prob are included

      • check that their length == ncol(X)

        • if not throw error

    • This does not check that the data is in a numeric form! (Check that yourself) get.X


Method get.X()

returns X matrix

Usage
iBAG_results$get.X()
Returns

matrix that should be n_patients rows and n_genes*n_data columns get.Y


Method get.Y()

returns Y vector

Usage
iBAG_results$get.Y()
Returns

vector that is n_patients long get.SS


Method get.SS()

returns the Sum of Squares mech model results, either all or some of them

Usage
iBAG_results$get.SS(index = NULL)
Arguments
index

(NULL) can be NULL, integer, or string. If NULL returns list, otherwise returns the vector at index

Returns

a vector or a list of vectors get.beta_mean


Method get.beta_mean()

returns the vector of posterior beta means

Usage
iBAG_results$get.beta_mean()
Returns

a vector of posterior beta means get.beta_incl_prob


Method get.beta_incl_prob()

returns a vector of posterior beta inclusion probabilities

Usage
iBAG_results$get.beta_incl_prob()
Returns

a vector of posterior beta inclusion probabilities get.n_patients


Method get.n_patients()

returns the number of patients

Usage
iBAG_results$get.n_patients()
Returns

integer of number of patients get.genes


Method get.n_genes()

returns the number of genes

Usage
iBAG_results$get.n_genes()
Returns

integer of number of genes get.n_data


Method get.n_data()

returns the number of upstream datasets

Usage
iBAG_results$get.n_data()
Returns

integer of number of upstream datasets


Method clone()

The objects of this class are cloneable with this method.

Usage
iBAG_results$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


cvraut/iBAGpkg documentation built on July 26, 2022, 9:55 p.m.