infer_profiles_vb {BPRMeth} | R Documentation

## Infer methylation profiles using VB

### Description

General purpose functions for inferring latent profiles for different observation models using Variational Bayes (VB). Current observation models are: 'bernoulli', 'binomial' or 'gaussian'.

### Usage

    infer_profiles_vb(
      X,
      model = NULL,
      basis = NULL,
      H = NULL,
      w = NULL,
      gaussian_l = 50,
      alpha_0 = 0.5,
      beta_0 = 0.1,
      vb_max_iter = 100,
      epsilon_conv = 1e-05,
      is_parallel = FALSE,
      no_cores = NULL,
      is_verbose = FALSE,
      ...
    )

### Arguments

`X` | The input data, either a `matrix` or a `list` of elements of length N, where each element is an `L X C` matrix, where L are the total number of observations. The first column contains the input observations x (i.e. CpG locations). If "binomial" model then C=3, and 2nd and 3rd columns contain total number of trials and number of successes respectively. If "bernoulli" or "gaussian" model, then C=2 containing the output y (e.g. methylation level).
`model` | Observation model name as character string. It can be either 'bernoulli', 'binomial', 'beta' or 'gaussian'.
`basis` | A 'basis' object. E.g. see `create_basis`. If NULL, will an RBF object will be created.
`H` | Optional, design matrix of the input data X. If NULL, H will be computed inside the function.
`w` | A vector of initial parameters (i.e. coefficients of the basis functions). If NULL, it will be initialized inside the function.
`gaussian_l` | Noise precision parameter, only used when having "gaussian" observation model.
`alpha_0` | Hyperparameter: shape parameter for Gamma distribution. A Gamma distribution is used as prior for the precision parameter tau.
`beta_0` | Hyperparameter: rate parameter for Gamma distribution. A Gamma distribution is used as prior for the precision parameter tau.
`vb_max_iter` | Integer denoting the maximum number of VB iterations.
`epsilon_conv` | Numeric denoting the convergence threshold for VB.
`is_parallel` | Logical, indicating if code should be run in parallel.
`no_cores` | Number of cores to be used, default is max_no_cores - 1.
`is_verbose` | Logical, print results during VB iterations.
`...` | Additional parameters.

### Value

An object of class `infer_profiles_vb_`"obs_model" with the following elements:

- `W`: An Nx(M+1) matrix with the optimized parameter values. Each row of the matrix corresponds to each element of the list X; if X is a matrix, then N = 1. The columns are of the same length as the parameter vector w (i.e. number of basis functions).

- `W_Sigma`: A list with covariance matrices for each element row in W.

- `basis`: The basis object.

- `nll_feat`: NLL fit feature.

- `rmse_feat`: RMSE fit feature.

- `coverage_feat`: CpG coverage feature.

- `lb_feat`: Lower Bound feature.

### Details

The modelling and mathematical details for inferring profiles using mean-field variational inference are explained here: http://rpubs.com/cakapourani/ . More specifically:

- For Binomial/Bernoulli observation model check: http://rpubs.com/cakapourani/variational-bayes-bpr

- For Gaussian observation model check: http://rpubs.com/cakapourani/variational-bayes-lr

### Author(s)

C.A.Kapourani C.A.Kapourani@ed.ac.uk

### See Also

`create_basis`, `infer_profiles_mle`, `predict_expr`, `create_region_object`

### Examples

    # Example of inferring parameters for synthetic data using 3 RBFs
    basis <- create_rbf_object(M=3)
    out <- infer_profiles_vb(X = binomial_data, model = "binomial",
       basis = basis, is_parallel = FALSE, vb_max_iter = 10)

    #-------------------------------------

    basis <- create_rbf_object(M=3)
    out <- infer_profiles_vb(X = gaussian_data, model = "gaussian",
       basis = basis, is_parallel = FALSE, vb_max_iter = 10)

[Package BPRMeth version 1.14.1 Index]