mash_compute_vloglik {mashr}R Documentation

Compute vector of loglikelihood for fitted mash object on new data

Description

Compute vector of loglikelihood for fitted mash object on new data

Usage

mash_compute_vloglik(g, data, algorithm.version = c("Rcpp", "R"))

Arguments

g

A mash object.

data

A set of data on which to compute the loglikelihood.

algorithm.version

Indicate R or Rcpp version

Details

The log-likelihood for each element is p(Bhat_j | Shat_j,g,\alpha) where Bhat_j | B_j, Shat_j \sim N(B_j, Shat_j) and B_j/Shat_j^\alpha | Shat_j \sim g Here the value of \alpha is set when setting up the data object in 'mash_set_data'. If g is a mash object (safest!) then the function will check that this value matches the \alpha used when fitting 'mash'. Note: as a convenience, this function can also be called with g a mixture distribution with same structure as the fitted_g from a mash object. This is mostly useful when doing simulations, where you might want to compute the likelihood under the "true" g. When used in this way the user is responsible for making sure that the g makes sense with the alpha set in data.

Value

The vector of log-likelihoods for each data point computed using g.

Examples

simdata = simple_sims(50,5,1)
data = mash_set_data(simdata$Bhat, simdata$Shat)
m = mash(data, cov_canonical(data))
mash_compute_vloglik(m,data)


[Package mashr version 0.2.79 Index]