Learn R Programming

deal (version 1.2-4)

addarrow: Adding/Turning/Removing arrows

Description

Create all networks with exactly one arrow added/turned/removed.

Usage

addarrow   (nw,df,prior,trylist=vector("list",nw$n)) 
turnarrow  (nw,df,prior,trylist=vector("list",nw$n)) 
removearrow(nw,df,prior,trylist=vector("list",nw$n))

Arguments

nw
an object of class network, from which arrows are added/removed/turned.
df
a data frame used for learning the network, see network.
prior
a list describing parameter priors, generated by jointprior.
trylist
a list, used internally for reusing learning of nodes, see maketrylist.

Value

  • A list with two elements
  • nwan object of class networkfamily, with all created networks. All networks have been learned.
  • trylistan updated list, used internally for reusing learning of nodes, see maketrylist.

Details

Given the starting network, a list of networks is created with exactly one arrow added/turned/removed. All possible networks (with the restrictions described in insert) are returned in the list of networks. All networks are learned with the data in df using the prior information in prior. The functions are used by autosearch.

References

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

See Also

heuristic, autosearch, insert, addarrows, network, networkfamily

Examples

Run this code
data(rats)
fit        <- network(rats)
fit.prior  <- jointprior(fit,12)
fit        <- learn(fit,rats,fit.prior)$nw
rats.extra <- addarrow(fit,rats,fit.prior)$nw
plot(rats.extra)
rats.extra2<- addarrow(rats.extra[[2]],rats,fit.prior)$nw
plot(rats.extra2)
rats.extra3<- turnarrow(rats.extra2[[2]],rats,fit.prior)$nw
plot(rats.extra3)
rats.extra4<- removearrow(rats.extra2[[2]],rats,fit.prior)$nw
plot(rats.extra4)

Run the code above in your browser using DataLab