qch.fit: Infer posterior probabilities of H_0/H_1 configurations.

View source: R/qch_fit.R

qch.fitR Documentation

Infer posterior probabilities of H_0/H_1 configurations.

Description

For each item, estimate the posterior probability for each configuration. This function use either the model accounting for the dependence structure through a Gaussian copula function (copula=="gaussian") or assuming the conditional independence (copula=="indep"). Utilizes parallel computing, when available. For package documentation, see qch-package.

Usage

qch.fit(
  pValMat,
  EffectMat = NULL,
  Hconfig,
  copula = "indep",
  threads_nb = 0,
  plotting = FALSE,
  Precision = 1e-06
)

Arguments

pValMat

A matrix of p-values, each column corresponding to a p-value serie.

EffectMat

A matrix of estimated effects corresponding to the p-values contained in pValMat. If specified, the procedure will account for the direction of the effect. (optional, default is NULL)

Hconfig

A list of all possible combination of H_0 and H_1 hypotheses generated by the GetHconfig() function.

copula

A string specifying the form of copula to use. Possible values are "indep"and "gaussian". Default is "indep" corresponding to the independent case.

threads_nb

The number of threads to use. The number of thread will set to the number of core available by default.

plotting

A boolean. Should some diagnostic graphs be plotted ? Default is FALSE.

Precision

The precision for EM algorithm to infer the parameters. Default is 1e-6.

Value

A list with the following elements:

prior vector of estimated prior probabilities for each of the H-configurations.
Rcopula the estimated correlation matrix of the Gaussian copula. (if applicable)
Hconfig the list of all configurations.
  • If the storage permits, the list will additionally contain:

    posterior matrix providing for each item (in row) its posterior probability to belong to each of the H-configurations (in columns).
    fHconfig matrix containing \psi_c densities evaluated at each items, each column corresponding to a configuration.
  • Else, the list will additionally contain:

    f0Mat matrix containing the evaluation of the marginal densities under H_0 at each items, each column corresponding to a p-value serie.
    f1Mat matrix containing the evaluation of the marginal densities under H_1 at each items, each column corresponding to a p-value serie.
    F0Mat matrix containing the evaluation of the marginal cdf under H_0 at each items, each column corresponding to a p-value serie.
    F1Mat matrix containing the evaluation of the marginal cdf under H_1 at each items, each column corresponding to a p-value serie.
    fHconfig_sum vector containing (\sum_cw_c\psi_c(Z_i)) for each items i.

The elements of interest are the posterior probabilities matrix, posterior, the estimated proportion of observations belonging to each configuration, prior, and the estimated correlation matrix of the Gaussian copula, Rcopula. The remaining elements are returned primarily for use by other functions.

Examples

data(PvalSets_cor)
PvalMat <- as.matrix(PvalSets_cor[,-3])
## Build the Hconfig objects
Q <- 2
Hconfig <- GetHconfig(Q)

## Run the function
res.fit <- qch.fit(pValMat = PvalMat,Hconfig = Hconfig,copula="gaussian")

## Display the prior of each class of items
res.fit$prior

## Display the correlation estimate of the gaussian copula
res.fit$Rcopula

## Display the first posteriors
head(res.fit$posterior)

qch documentation built on May 29, 2024, 8:11 a.m.