Package 'saturnin'

Title: Spanning Trees Used for Network Inference
Description: Bayesian inference of graphical model structures using spanning trees.
Authors: Loïc Schwaller
Maintainer: Loïc Schwaller <[email protected]>
License: GPL-2
Version: 1.1.1
Built: 2025-03-13 04:00:48 UTC
Source: https://github.com/cran/saturnin

Help Index


Spanning Trees Used for Network Inference

Description

Bayesian inference of graphical model structures using spanning trees. For further details on the considered framework, we refer the reader to the paper quoted in the references section.

Details

Package: saturnin
Type: Package
Version: 1.0
Date: 2015-04-10
License: GPL-2

Author(s)

Loïc Schwaller

Maintainer: Loïc Schwaller <[email protected]>

References

This package implements the method described in the paper "Bayesian Inference of Graphical Model Structures Using Trees" by L. Schwaller, S. Robin, M. Stumpf, 2015 (submitted and availavable on arXiv).

Examples

library('saturnin')
data(data_gaussian)

W <- lweights_gaussian(data_gaussian)
prob <- edge.prob(W, log = TRUE, account.prior = TRUE, q0 = 0.5)

Accounting for prior edge appearance probability.

Description

The function transforms the posterior edge appearance probability matrix given by edge.prob to account for prior edge appearance probability. For further details on the transformation, we refer the reader to the paper quoted in the references section. The function can be directly applied in edge.prob by setting account.prior to TRUE.

Usage

account.for.prior(prob, q0)

Arguments

prob

Posterior edge appearance probability matrix.

q0

Desired prior edge appearance probability.

Value

prob.q0

Transformed posterior edge appearance probability matrix.

Author(s)

Loïc Schwaller

References

This package implements the method described in the paper "Bayesian Inference of Graphical Model Structures Using Trees" by L. Schwaller, S. Robin, M. Stumpf, 2015 (submitted and availavable on arXiv).

Examples

library('saturnin')
data(data_gaussian)

W <- lweights_gaussian(data_gaussian)
prob <- edge.prob(W, log = TRUE)

prob.q0 <- account.for.prior(prob, q0 = 0.5)

Gaussian data.

Description

Sample of size n=100n=100 from a multivariate gaussian distribution with p=50p=50 variables.

Usage

data("data_gaussian")

Format

The format is: num [1:50, 1:100] 1.001 -0.21 0.513 0.166 2.135 ...

Examples

data(data_gaussian)

Multinomial data.

Description

Sample of size n=100n=100 from a multinomial distribution with p=100p=100 variables.

Usage

data("data_multinomial")

Format

The format is: int [1:100, 1:100] 8 10 5 3 2 8 3 5 8 3 ...

Examples

data(data_multinomial)

Computation of posterior edge appearance probabilities in a random tree.

Description

The function computes posterior edge appearance probabilities in a random tree from a (log-)weight matrix. The (log-)weight matrix can be obtained from one of the functions lweights_multinomial, lweights_gaussian or weights_gausscopula. The function can also account for prior edge appearance probability.

Usage

edge.prob(W, log = TRUE, account.prior = FALSE, q0 = 0.5)

Arguments

W

(log-)weight matrix

log

TRUE when using a log-weight matrix, FALSE otherwise.

account.prior

FALSE for no accounting, TRUE otherwise.

q0

Desired prior edge appearance probability.

Value

prob

Posterior edge appearance probability matrix.

Author(s)

Loïc Schwaller

References

This package implements the method described in the paper "Bayesian Inference of Graphical Model Structures Using Trees" by L. Schwaller, S. Robin, M. Stumpf, 2015 (submitted and availavable on arXiv).

Examples

library('saturnin')
data(data_gaussian)

W <- lweights_gaussian(data_gaussian)
prob <- edge.prob(W, log = TRUE, account.prior = TRUE, q0 = 0.5)

Computation of the log-weight matrix in a gaussian setting.

Description

The function computes the log-weights of all edges in a gaussian setting. The result should be used in edge.prob with argument log set to TRUE. Usual values are used as default for the prior normal-Wishart hyperparameters. Computation can be parallelized by setting nbcores to more than 2. Parallelization relies on parallel.

Usage

lweights_gaussian(data, 
      a = ncol(data), 
      mu = numeric(p), 
      au = 1, 
      T = diag(ncol(data), 
      ncol(data)), 
      nbcores = 1)

Arguments

data

Matrix containing continuous data.

a

Prior degree of freedom of the normal-Wishart distribution.

mu

Prior mean for the mean of the normal-Wishart distribution.

au

Prior relative precision of the normal-Wishart distribution.

T

Prior scale matrix of the normal-Wishart distribution.

nbcores

Number of cores to be used in parallelized computation.

Value

W

log-weight matrix

Author(s)

Loïc Schwaller

References

This package implements the method described in the paper "Bayesian Inference of Graphical Model Structures Using Trees" by L. Schwaller, S. Robin, M. Stumpf, 2015 (submitted and availavable on arXiv).

Examples

library('saturnin')
data(data_gaussian)

W <- lweights_gaussian(data_gaussian)

prob <- edge.prob(W, log = TRUE)

Computation of the log-weight matrix in a multinomial setting.

Description

The function computes the log-weights of all edges in a multinomial setting. The result should be used in edge.prob with argument log set to TRUE. Prior counts can be generated using the function prior_unif_dirichlet. Computation can be parallelized by setting nbcores to more than 2. Parallelization relies on parallel.

Usage

lweights_multinomial(data, prior = defaut.prior, nbcores = 1)

Arguments

data

Matrix containing discrete data.

prior

Prior to be used for the Dirichlet distribution.

nbcores

Number of cores to be used in parallelized computation.

Value

W

log-weight matrix.

Author(s)

Loïc Schwaller

References

This package implements the method described in the paper "Bayesian Inference of Graphical Model Structures Using Trees" by L. Schwaller, S. Robin, M. Stumpf, 2015 (submitted and availavable on arXiv).

Examples

library('saturnin')
data(data_multinomial)

W <- lweights_multinomial(data_multinomial)

prob <- edge.prob(W, log = TRUE)

Uniform prior counts for the hyper-Dirichlet distribution.

Description

The function generates a (r,r,p,p)(r,r,p,p)-array filled with uniform counts for the hyper-Dirichlet distribution used as prior in lweights_multinomial when there are pp variables with rr levels. Neq is the equivalent prior sample size.

Usage

prior_unif_dirichlet(p, r, Neq = 0.5 * r^2)

Arguments

p

Number of variables.

r

Number of levels.

Neq

Equivalent sample size.

Value

prior

A (r,r,p,p)(r,r,p,p)-array containings counts.

Author(s)

Loïc Schwaller

References

This package implements the method described in the paper "Bayesian Inference of Graphical Model Structures Using Trees" by L. Schwaller, S. Robin, M. Stumpf, 2015 (submitted and availavable on arXiv).

Examples

library('saturnin')
p <- 100
r <- 10
prior <- prior_unif_dirichlet(p,r)

Computation of the weight matrix in a gaussian copula setting.

Description

The function computes the weights of all edges in a gaussian copula setting. The result should be used in edge.prob with argument log set to FALSE. The function brings the values of all variables back to [0;1][0;1] by computing univariate empirical cdf functions. The prior distribution for the correlation of the bivariate gaussian copulas prior can be set to either "uniform" or "beta". Beta prior is understood as a beta distribution with a change of variables to bring it back to [1;1][-1;1]. Computation can be parallelized by setting nbcores to more than 2. Parallelization relies on parallel.

Usage

weights_gausscopula(data, prior_type = "uniform", a = 1, b = 1, nbcores = 1)

Arguments

data

Matrix containing the data.

prior_type

Prior to be used for the correlation.

a

Shape parameter 1 for beta prior.

b

Shape parameter 2 for beta prior.

nbcores

Number of cores to be used in parallelized computation.

Value

W

weight matrix.

Author(s)

Loïc Schwaller

References

This package implements the method described in the paper "Bayesian Inference of Graphical Model Structures Using Trees" by L. Schwaller, S. Robin, M. Stumpf, 2015 (submitted and availavable on arXiv).

Examples

library('saturnin')
data(data_multinomial)

W <- weights_gausscopula(data_multinomial)

prob <- edge.prob(W, log = FALSE)