Given a network with a prob property for each node, derives the
  joint probability distribution. Then the quantities needed in
the local master procedure for finding the local parameter priors are
deduced.
jointprior(nw,N=NA,phiprior="bottcher",timetrace=FALSE)A list with the following elements,
a table used in the local master procedure for discrete variables.
a table used in the local master procedure for continuous variables.
a table used in the local master procedure for continuous variables.
a numeric matrix used in the local master procedure for continuous variables.
a list of numeric matrices (not used in further calculations).
a list of numeric matrices used in the local master procedure for continuous variables.
an object of class network. Each node must
    have a prob property to describe the local probability
    distribution. The prob property
    is created using prob method for network objects, which is called by the
    network function.
an integer, which gives the size of the imaginary data base. If
    this is too small, 
    NA's may be created in the output, resulting in errors in
    learn. If no N is given, the procedure tries to 
    set a value as low as possible.
a string, which specifies how the prior for phi is
    calculated. Either phiprior="bottcher" or
    phiprior="heckerman" can be used.
a logical. If TRUE, prints some timing
    information on the screen.
Susanne Gammelgaard Bottcher, 
  Claus Dethlefsen rpackage.deal@gmail.com.
For the discrete part of the network, the joint probability
  distribution is 
  calculated by multiplying together the local probability
  distributions. Then, jointalpha is determined by multiplying
  each entry in the joint probability distribution by the size of the
  imaginary data base N.
For the mixed part of the network, for each configuration of the discrete
  variables, the joint Gaussian distribution of the continuous
  variables is constructed and represented by jointmu (one
  row for each configuration of the discrete parents) and
  jointsigma (a list of matrices -- one for each configuration of
  the discrete parents). The configurations of the discrete parents are
  ordered according to findex. The algorithm for
  constructing the joint distribution of the continuous variables is
  described in Shachter and Kenley (1989).
Then, jointalpha, jointnu, jointrho, mu and
  jointphi are deduced. These quantities are later used for
deriving local parameter priors.
For each configuration i of the discrete variables,
  $$\nu_i=\rho_i=\alpha_i$$ and
  $$\phi_i = (\nu_i -1)\Sigma_i$$
  if phiprior="bottcher", see Bottcher(2001) and
  $$\phi_i = \nu_i(\rho_i -2)\Sigma_i/(\nu_i+1)$$
  if phiprior="heckerman", see Heckerman, Geiger and Chickering (1995).
Bottcher, S.G. (2001). Learning Bayesian Networks with Mixed Variables, Artificial Intelligence and Statistics 2001, Morgan Kaufmann, San Francisco, CA, USA, 149-156.
Heckerman, D., Geiger, D. and Chickering, D. (1995). Learning Bayesian networks: The combination of knowledge and statistical data. Machine Learning, 20: 197-243.
Shachter, R.D. and Kenley, C.R. (1989), Gaussian influence diagrams. Management Science, 35:527-550.
network, prob
data(rats)
rats.nw    <- network(rats)
rats.prior <- jointprior(rats.nw,12)
if (FALSE) savenet(rats.nw,file("rats.net"))
if (FALSE) rats.nw <- readnet(file("rats.net"))
if (FALSE) rats.nw <- prob(rats.nw,rats)
if (FALSE) rats.prior <- jointprior(rats.nw,12)
Run the code above in your browser using DataLab