Computes the Kullback-Leibler divergence between Polya-Gamma and Dirichlet priors

Compute the KL divergence between two Dirichlet distributions

A function to compute the prior predictive distribution of the Dirichlet prior.

A function to compute the prior predictive distribution of the Polya-Gamma prior.

kldirpg(sigma = diag(1, 1, 1), mu = c(0, 0, 0), alpha = c(1))

kldir(alpha, beta)

prior_pred_dir(object, fcol = "markers", iter = 5000, dirPrior = NULL, q = 15)

prior_pred_pg(
  objectCond1,
  objectCond2,
  fcol = "markers",
  tau = 0.2,
  lambda = 0.01,
  mu_prior = NULL,
  iter = 10000,
  q = 15
)

Arguments

sigma

the sigma parameter of the Polya-Gamma prior. A positive-definite symmetric matrix.

mu

the mu parameter of the Polya-Gamma prior. A vector of means

alpha

The concentration parameter of the first Dirichlet distribution

beta

The concentration parameter of the second Dirichlet distribution

object

An instance of class MSnSet

fcol

The feature column indiating the markers. Default is "markers"

iter

Number of sample to use from prior predictive distribution. Default is 10000

dirPrior

The Dirichlet prior used. If NULL (default) will generate a a default Dirichlet prior. This should be a matrix with the same dimensions as the number of subcellular niches. The diagonal terms correspond to the prior probability of not differentially localising. The (i,j) term corresponds to prior probability of differntially localising between niche i and j.

q

The upper tail value. That is the prior probability of having more than q differential localisations. Default is 15.

objectCond1

An instance of class MSnSet, usually the control dataset

objectCond2

An instance of class MSnSet, usually the treatment dataset

tau

The tau parameter of the Polya-Gamma prior. Default is 0.2.

lambda

The lambda ridge parameter used for numerical stability. Default is 0.01

mu_prior

The mean of the Polya-Gamma prior. Default is NULL which generates a default Polya-Gamma prior.

Value

returns a numeric indicating the KL divergence

a numeric indicating the KL divergence

A list contain the prior predictive distribution of differential localisations, the mean number of differential localised proteins and the probability than more than q are differentially localised

A list contain the prior predictive distribution of differential localisations, the mean number of differential localised proteins and the probability than more than q are differentially localised

Examples

kldirpg(sigma = diag(c(1,1,1)), mu = c(0,0,0), alpha = 1)
#> [1] -0.09793252

kldir(c(1,1), c(3,1))
#> [1] 0.9013877

library(pRolocdata)
data("tan2009r1")

out <- prior_pred_dir(object = tan2009r1)

library(pRolocdata)
data("tan2009r1")
set.seed(1)
tansim <- sim_dynamic(object = tan2009r1, 
                    numRep = 6L,
                   numDyn = 100L)
d1 <- tansim$lopitrep
control1 <- d1[1:3]
treatment1 <- d1[4:6]
out <- prior_pred_pg(objectCond1 = control1[[1]],
objectCond2 = treatment1[[1]])