Learn R Programming

deal (version 1.2-4)

post: Calculation of parameter posteriors for continuous node

Description

Learns the parameters and calculates the network score contribution for continuous nodes.

Usage

post   (mu,tau,rho,phi,y,z,timetrace=FALSE) 
postM  (mu,tau,rho,phi,y,z,timetrace=FALSE) 
postc  (mu,tau,rho,phi,y,z,timetrace=FALSE) 
postcc (mu,tau,rho,phi,y,z,timetrace=FALSE) 
post0  (mu,tau,rho,phi,y,timetrace=FALSE) 
postc0c(mu,tau,rho,phi,y,timetrace=FALSE)

Arguments

mu
a numeric vector of dimension 1 + the number of continuous parents. mu is a parameter in the local master, see conditional.
tau
a numeric matrix, which gives the unscaled precision matrix of regression parameters. Symmetric matrix with number of columns and rows equal to 1 plus number of continous parents.
rho
a numeric, which gives a parameter in the distribution of the scale parameter.
phi
a numeric, which gives a parameter in the distribution of the scale parameter.
y
a numeric vector of observations of the current node.
z
a numeric matrix with a column of ones and columns with the observations of the continuous parents.
timetrace
a logical. If TRUE, prints some timing information on the screen.

Value

  • A list with the following components,
  • munumeric vector, giving the posterior mean of the regression parameters.
  • taua numeric matrix, which gives the posterior unscaled precision matrix of regression parameters.
  • rhoa numeric, which gives the posterior of a parameter in the distribution of the scale parameter.
  • phia numeric, which gives the posterior of a parameter in the distribution of the scale parameter.
  • loglika numeric, which gives the log-likelihood contribution to the network score for this node.

Details

These functions are called by the learning routines (see learn) and is only intended for internal use. In fact, only postc0c and postcc are used for speed reasons. The remaining functions are included for experimental purposes. post0: posterior for continuous node with 0 parents as batch learning. postc0c: as post0, but using sequential learning in C. postc: posterior for continuous node with continuous parents. Sequential learning. post: as postc, but as batch learning. postM: as post, but using the Matrix library. postcc: as postc, but using C.

References

Further information about deal can be found at: http://www.math.auc.dk/novo/deal.

See Also

learnnode, conditional

Examples

Run this code
data(rats)
  fit       <- network(rats)
  fit.prior <- jointprior(fit,12)
  W1        <- fit$nodes$W1
  W1        <- cond.node(W1,fit,fit.prior)
  W1.post   <-  postc0c(W1$condprior[[1]]$mu,
                       W1$condprior[[1]]$tau,
                       W1$condprior[[1]]$rho,
                       W1$condprior[[1]]$phi,
                       rats[,W1$idx])

Run the code above in your browser using DataLab