infer_profiles_gibbs {BPRMeth} | R Documentation

## Infer methylation profiles using Gibbs sampling

### Description

General purpose functions for inferring latent profiles for different observation models using Gibbs sampling. Currently implemented observation models are: 'bernoulli' and 'binomial' and the auxiliary variable approach is used.

### Usage

    infer_profiles_gibbs(
      X,
      model = NULL,
      basis = NULL,
      H = NULL,
      w = NULL,
      mu_0 = NULL,
      cov_0 = NULL,
      gibbs_nsim = 500,
      gibbs_burn_in = 100,
      store_gibbs_draws = FALSE,
      is_parallel = FALSE,
      no_cores = NULL,
      ...
    )

### 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" then C=2 containing the output y (e.g. methylation level).
`model` | Observation model name as character string. It can be either 'bernoulli' or 'binomial'.
`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.
`mu_0` | The prior mean hyperparameter vector for w.
`cov_0` | The prior covariance hyperparameter matrix for w.
`gibbs_nsim` | Total number of simulations for the Gibbs sampler.
`gibbs_burn_in` | Burn in period of the Gibbs sampler.
`store_gibbs_draws` | Logical indicating if we should keep the whole MCMC chain for further analysis.
`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.
`...` | Additional parameters.

### Value

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

- `W`: An Nx(M+1) matrix with the posterior mean of the parameters w. 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_sd`: An Nx(M+1) matrix with the posterior standard deviation (sd) of the parameters W.

- `basis`: The basis object.

- `nll_feat`: NLL fit feature.

- `rmse_feat`: RMSE fit feature.

- `coverage_feat`: CpG coverage feature.

- `W_draws`: Optional, draws of the Gibbs sampler.

### Details

The modelling and mathematical details for inferring profiles using Gibbs sampling are explained here: http://rpubs.com/cakapourani/ . More specifically:

- For Binomial observation model check: http://rpubs.com/cakapourani/bayesian-bpr-model

- For Bernoulli observation model check: http://rpubs.com/cakapourani/bayesian-bpr-model

### Author(s)

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

### See Also

`create_basis`, `infer_profiles_mle`, `infer_profiles_vb`, `create_region_object`

### Examples

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

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

[Package BPRMeth version 1.16.0 Index]