Learn R Programming

deal (version 1.1-2)

node: Nodes

Description

An important part of a network is the list of nodes. The nodes summarizes the local properties of the 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,equalcases=FALSE,vif=1.0,smalldf=NA)

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 dataframe).
type
"discrete" or "continuous".
name
The name used in when plotting and printing. Defaults to the column name in the dataframe.
levels
If type="discrete", this is the number of levels for the discrete variable.
levelnames
If type="discrete" this is a vector of strings (as long 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 dataframe, where the columns define the variables. A continuous variable should have type "numeric" and discrete varibles should have type "factor".
equalcases
When calculating the probability distribution for discrete variables, do not (if TRUE) set the probability equal to the observed frequency. If FALSE, observed frequencies are used.
vif
Variance inflation factor. For continuous nodes, the probability distribution is assumed normal with a mean depending on the parents and a variance for each configuration of the discrete parents. The mean and variance are deduced from data
tvar
Pinpoint time-varying nodes, see timeslice.
smalldf
For use with timevarying nodes, see timeslice.
nw
The network.
scale
Used to position node.
filename
Print to file.
condprior
Print condprior?
condposterior
Print condposterior?
master
Print master?
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 dataframe.
  • 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 are 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.
  • tvarIf missing, the node is not timevarying.
  • 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