localLogScoreNormal: Local Normal-inverse-gamma (with g-prior) Log marginal...

Description Usage Arguments Details Value References See Also

View source: R/score-normal.R

Description

Compute the LOCAL log marginal likelihood of the supplied Bayesian Networks. ie the contribution to the log marginal liklihood from one individual node.

Usage

1
2
  localLogScoreNormal(node, parents, logScoreParameters,
    cache, checkInput = T)

Arguments

node

A numeric vector of length 1. The node to compute the local log score for.

parents

A numeric vector. The parents of node.

logScoreParameters

A list with the following components:

data

A matrix with columns giving the values of each random variable.

nl

A numeric vector of length nNodes(currentBN), specifying the number of levels that each random variable takes.

cache

Optionally, provide an environment with cached local scores for this data.

checkInput

A logical of length 1, specifying whether to check the inputs to the function.

Details

Let X be a data matrix with a number of predictors (in columns), and y be an response variable, and that n observations are available for each. For a graph G (since this is local score this is equivalent to an indicator vector), the model used is takes the form y = phi_G * beta + epsilon with epsilon ~ N(0, sigma^{2} I). Note that the data needs to be standardised (zero-meaned).

The design matrix phi_{G} is a column of 1s, and then columns corresponding to each of the parents of the node. No cross-terms are included.

The prior used factorises as p(beta, sigma) = p(beta | sigma)p(sigma), The variance has an uninformative, scale invariant Jeffrey's prior p(sigma) = 1/sigma^2, and the coefficients have a zero-mean Normal prior (a Zellner g-prior), with g = n, so that beta | sigma ~ N(0, g * sigma^2 * (phi'_G phi_G)^-1)

The above specification gives the following marginal likelihood.

P(y | G) propto (1 + n)^(-(eta + 1)/2) * (X' * X - (n/(n + 1)) * X' * phi_G * (phi'_G * phi_G)^(-1) * phi_G * X)^(-n/2)

Value

A numeric vector of length 1, giving the log marginal likelihood. The environment 'cache' will also be updated because its scope is global.

References

Nott, D. J., & Green, P. J. (2004). Bayesian Variable Selection and the Swendsen-Wang Algorithm. Journal of Computational and Graphical Statistics, 13, 141-157. http://dx.doi.org/10.1198/1061860042958

Smith, M., & Kohn, R. (1996). Nonparametric Regression using Bayesian Variable Selection. Journal of Econometrics, 75, 317-343. http://dx.doi.org/10.1016/0304-4076(95)01763-1.

Geiger, D., & Heckerman, D. (1994). Learning Gaussian Networks. Proceedings of the 10th Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI-94), 235-240. http://uai.sis.pitt.edu/displayArticleDetails.jsp?mmnu=1&smnu=2& article_id=509&proceeding_id=10

See Also

logScoreNormal, logScoreNormalOffline, logScoreNormalIncremental.


rjbgoudie/structmcmc documentation built on Nov. 3, 2020, 3:41 a.m.