dmgbayes.gaussiansample(dmgbayes) | R Documentation |
A Gibbs sampling procedure to sample parameters from the posterior distribution of a Gaussian model that is parameterized by a Gaussian directed mixed graph model. The output is stored in a data file.
dmgbayes.gaussiansample(var.names, directed, bidirected, train, islatent, prior.V, dmg.df, b.priormean, b.priorvar, b.fixed, mcmc.num.samples, mcmc.burn.in, mcmc.step, output.filename, mcmc.options, test = NULL)
var.names |
Array of string naming all variables (observed and latents) |
directed |
A m x 2 array, where each row (i, j) encodes a directed edge from the jth variable into the ith variable. All variables should be encoded as integers (1, 2, 3, ...), and their number should match the corresponding entry in var.names |
bidirected |
A m' x 2 array, m' being the total number of bi-directed edges. As above, each two-dimensional row (i, j) encodes a bi-directed edge connecting the ith and jth variables |
train |
Data which we condition on when computing the posterior |
islatent |
Binary array, indicating with '1' which variables in var.names are unobserved variables |
prior.V |
A p x p matrix with the matrix parameter of the G-Inverse Wishart prior for the covariance matrix of the error terms |
dmg.df |
Degrees of freedom of the same prior |
b.priormean |
A (m + p) dimensional array contaning the mean parameter of the Gaussian prior for each coefficient associated with the respective directed edge. *IMPORTANT*: remember that we have to consider the intercept terms too. The intercept term for each variable $Y_i$ should be located just after the other coefficients for $Y_i$. This explains why this afrray has m + p dimensions |
b.priorvar |
The respective variances |
b.fixed |
A (m + p) dimensional binary array indicating with '1' those coefficients that are to be fixed to a constant value. The constant to be used is the respective entry in b.priormean. *REMEMBER*: intercepts should be considered |
mcmc.num.samples |
Total number of samples to be generated in the Markov chain |
mcmc.burn.in |
Total number of initial samples to be skipped when storing the results of the chain (minimum value: 0) |
mcmc.step |
Interval between points that will be stored in the output file |
output.filename |
Name of the file to which samples points will be stored |
mcmc.options |
A numeric array contain miscellaneous options: mcmc.options[1] is a number between 1 and 4 indicating verbosity level of output messages returned to the R console; mcmc.options[2] should be set to '1' if you want to generate a file with sampled latents. This file will be called 'output.filename'.latents |
test |
Optional matrix with test data to be evaluated by predictive log-likelihood |
Ricardo Silva, Statistical Laboratory, University of Cambridge
Silva, R. (2008). "A Tutorial on dmgBayes: Bayesian Analysis for Directed Mixed Graph Models"
dmgbayes.gaussian.marginal.bidirected