Bane: Bane Class

Description Details Public fields Methods

Description

R6 class to implement the BaNE model

Details

Bane class

Public fields

indep

independent variable names

dep

list of variables dependencies

mu

independent variable priors

lm

dependent variable priors

n

Number of independent nodes

m

Number of dependent nodes

k

Number of total nodes

N

Rows of data

data

Data frame containing phenotype data

all_conds

Character vector of all condtion names

param_names

Names of all model parameters

J

Total number of parameters

M

Structure of the parameter matrix

M_

A helper object

q_

A helper object

mu_pr

The mean vector for the multivariate normal prior

Sig_inv

The precision matrix for the multivariate normal prior

LD_Data

Data formatted as a list for LaplacesDemon

ld

Output from LaplacesDemon, the posterior sampler

Methods

Public methods


Method intialize()

Intialize the R6 object

Usage
Bane$intialize()
Returns

A new 'Bane object'


Method create_model()

Create a new BaNE model

Usage
Bane$create_model(indep, dep, mu, lm, data)
Arguments
indep

A character vector of independent variable names.

dep

A named list of dependent variables with their dependencies. List names are the dependent variable names and list elements are the corresponding vector of dependency names.

mu

Prior proportions for independent variables.

lm

Prior baseline proportions for dependent variables.

data

A dataframe whose columns are referenced by dep and indep

Returns

Updates the object with side effects


Method params_to_mat()

Helper function to structure parameters as a matrix

Usage
Bane$params_to_mat(p)
Arguments
p

Vector of model parameters

Returns

A matrix of size (k+1) x k


Method LLX()

Log likelihood

Usage
Bane$LLX(p, data)
Arguments
p

Vector of model parameters

data

A data matrix

Returns

The log likelihood value of 'p' given 'data'


Method LPR()

Log prior

Usage
Bane$LPR(p)
Arguments
p

Vector of model parameters

Returns

The log prior evaluated at 'p'


Method LD_Model()

Log posterior

Usage
Bane$LD_Model(p, data)
Arguments
p

Vector of model parameters

data

A data matrix

Returns

A posterior evalutions in LaplacesDemon format


Method run_chain()

Run the HMC sampler

Usage
Bane$run_chain(Iterations = 2000, Status = 100, Thinning = 5, eps = 0.1, L = 3)
Arguments
Iterations

passed to 'LaplacesDemon'

Status

passed to 'LaplacesDemon'

Thinning

passed to 'LaplacesDemon'

eps

passed to 'LaplacesDemon'

L

passed to 'LaplacesDemon'

Returns

A LaplacesDemon object contain sampler info and posterior draws


Method maximum_likelihood()

Mode/ maximum likelihood

Usage
Bane$maximum_likelihood()
Returns

Output from the 'optim' function maximizng the likelihood function


Method post_subs()

Posterior sampled subcohort proportions

Usage
Bane$post_subs()
Returns

A list with subcohort, corresponding proportion draws, and a plot


Method plot_topology()

Plot the phenotype topology

Usage
Bane$plot_topology()
Returns

A ggplot with phenotype topology


Method print()

Print details about the object

Usage
Bane$print()
Returns

Side effects – printing


Method clone()

The objects of this class are cloneable with this method.

Usage
Bane$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


jackvanschaik/bane documentation built on Dec. 20, 2021, 8:06 p.m.