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 |
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.
Package: | saturnin |
Type: | Package |
Version: | 1.0 |
Date: | 2015-04-10 |
License: | GPL-2 |
Loïc Schwaller
Maintainer: Loïc Schwaller <[email protected]>
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).
library('saturnin') data(data_gaussian) W <- lweights_gaussian(data_gaussian) prob <- edge.prob(W, log = TRUE, account.prior = TRUE, q0 = 0.5)
library('saturnin') data(data_gaussian) W <- lweights_gaussian(data_gaussian) prob <- edge.prob(W, log = TRUE, account.prior = TRUE, q0 = 0.5)
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
.
account.for.prior(prob, q0)
account.for.prior(prob, q0)
prob |
Posterior edge appearance probability matrix. |
q0 |
Desired prior edge appearance probability. |
prob.q0 |
Transformed posterior edge appearance probability matrix. |
Loïc Schwaller
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).
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)
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)
Sample of size from a multivariate gaussian distribution with
variables.
data("data_gaussian")
data("data_gaussian")
The format is: num [1:50, 1:100] 1.001 -0.21 0.513 0.166 2.135 ...
data(data_gaussian)
data(data_gaussian)
Sample of size from a multinomial distribution with
variables.
data("data_multinomial")
data("data_multinomial")
The format is: int [1:100, 1:100] 8 10 5 3 2 8 3 5 8 3 ...
data(data_multinomial)
data(data_multinomial)
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.
edge.prob(W, log = TRUE, account.prior = FALSE, q0 = 0.5)
edge.prob(W, log = TRUE, account.prior = FALSE, q0 = 0.5)
W |
(log-)weight matrix |
log |
|
account.prior |
|
q0 |
Desired prior edge appearance probability. |
prob |
Posterior edge appearance probability matrix. |
Loïc Schwaller
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).
library('saturnin') data(data_gaussian) W <- lweights_gaussian(data_gaussian) prob <- edge.prob(W, log = TRUE, account.prior = TRUE, q0 = 0.5)
library('saturnin') data(data_gaussian) W <- lweights_gaussian(data_gaussian) prob <- edge.prob(W, log = TRUE, account.prior = TRUE, q0 = 0.5)
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
.
lweights_gaussian(data, a = ncol(data), mu = numeric(p), au = 1, T = diag(ncol(data), ncol(data)), nbcores = 1)
lweights_gaussian(data, a = ncol(data), mu = numeric(p), au = 1, T = diag(ncol(data), ncol(data)), nbcores = 1)
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. |
W |
log-weight matrix |
Loïc Schwaller
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).
library('saturnin') data(data_gaussian) W <- lweights_gaussian(data_gaussian) prob <- edge.prob(W, log = TRUE)
library('saturnin') data(data_gaussian) W <- lweights_gaussian(data_gaussian) prob <- edge.prob(W, log = TRUE)
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
.
lweights_multinomial(data, prior = defaut.prior, nbcores = 1)
lweights_multinomial(data, prior = defaut.prior, nbcores = 1)
data |
Matrix containing discrete data. |
prior |
Prior to be used for the Dirichlet distribution. |
nbcores |
Number of cores to be used in parallelized computation. |
W |
log-weight matrix. |
Loïc Schwaller
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).
library('saturnin') data(data_multinomial) W <- lweights_multinomial(data_multinomial) prob <- edge.prob(W, log = TRUE)
library('saturnin') data(data_multinomial) W <- lweights_multinomial(data_multinomial) prob <- edge.prob(W, log = TRUE)
The function generates a -array filled with uniform counts for the hyper-Dirichlet distribution used as prior in lweights_multinomial when there are
variables with
levels.
Neq
is the equivalent prior sample size.
prior_unif_dirichlet(p, r, Neq = 0.5 * r^2)
prior_unif_dirichlet(p, r, Neq = 0.5 * r^2)
p |
Number of variables. |
r |
Number of levels. |
Neq |
Equivalent sample size. |
prior |
A |
Loïc Schwaller
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).
library('saturnin') p <- 100 r <- 10 prior <- prior_unif_dirichlet(p,r)
library('saturnin') p <- 100 r <- 10 prior <- prior_unif_dirichlet(p,r)
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 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 .
Computation can be parallelized by setting
nbcores
to more than 2. Parallelization relies on parallel
.
weights_gausscopula(data, prior_type = "uniform", a = 1, b = 1, nbcores = 1)
weights_gausscopula(data, prior_type = "uniform", a = 1, b = 1, nbcores = 1)
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. |
W |
weight matrix. |
Loïc Schwaller
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).
library('saturnin') data(data_multinomial) W <- weights_gausscopula(data_multinomial) prob <- edge.prob(W, log = FALSE)
library('saturnin') data(data_multinomial) W <- weights_gausscopula(data_multinomial) prob <- edge.prob(W, log = FALSE)