Learn R Programming

deal (version 1.1-15)

node: Nodes

Description

An important part of a network is the list of nodes. The nodes summarize the local properties of a node given the parents of the node.

Usage

node (idx,parents,type,name=paste(idx),
                 levels=2,levelnames=paste(1:levels),position=c(0,0)) 
## S3 method for class 'node':
print (x,filename=NA,master=FALSE,condposterior=TRUE,condprior=TRUE,...) 
## S3 method for class 'node':
plot (x,cexscale=10,notext=FALSE,scale=10,...)
prob.node (x,nw,df)

Arguments

x
Node.
parents
A vector with indices of the parents of the node.
idx
The index of the node (the column number of the data frame).
type
"discrete" or "continuous".
name
The name used when plotting and printing. Defaults to the column name in the data frame.
levels
If type="discrete", this is the number of levels for the discrete variable.
levelnames
If type="discrete" this is a vector of strings (same size as levels) with the names of the levels.
position
The coordinates where the node should appear in the plot. Usually set by network and drawnetwork.
df
A data frame, where the columns define the variables. A continuous variable should have type "numeric" and discrete varibles should have type "factor".
nw
The network.
filename
If a string argument is given, output is printed to a file.
condprior
Print condprior? TRUE/FALSE
condposterior
Print condposterior? TRUE/FALSE
master
Print master? TRUE/FALSE.
scale
Used to position node.
cexscale
The size of the nodes.
notext
If FALSE, do not display text on plots.
...
Passed to plot.

Value

  • A node object may have the following attributes
  • idxA unique index for this node. It MUST correspond to the column index of the variable in the data frame.
  • nameThe printed name of the node.
  • typeEither continuous or discrete.
  • levelsIf the node is of type discrete, this integer is the number of levels of the node.
  • levelnamesIf the node is of type discrete, this vector of strings is the names of the levels. This must have length equal to levels.
  • parentsA vector of indices of the parents to this node. It is best to manage this vector using the insert function.
  • probThe initial probability distribution, set by network.
  • condpriorThe parameter priors deduced from jointprior using the master prior procedure (see localmaster).
  • condposteriorThe parameter posteriors obtained from learnnode.
  • loglikThe log likelihood contribution for this node, calculated in learnnode.
  • simprobAdded by makesimprob and used by simulation.

References

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

Examples

Run this code
A <- factor(rep(c("A1","A2"),50))
B <- factor(rep(rep(c("B1","B2"),25),2))
thisnet <- network( data.frame(A,B) )

Run the code above in your browser using DataLab