addrandomarrow {deal}R Documentation

Adding/Turning/Removing random arrows

Description

Create network with exactly one arrow added/turned/removed randomly chosen.

Usage

addrandomarrow(nw,data,prior,trylist=vector("list",nw$n),nocalc=FALSE,
               timetrace=FALSE)
turnrandomarrow(nw,data,prior,trylist=vector("list",nw$n),nocalc=FALSE,
               timetrace=FALSE)
deleterandomarrow(nw,data,prior,trylist=vector("list"),nw$n),nocalc=FALSE,
               timetrace=timetrace)  

Arguments

nw an object of class network, from which arrows are added/removed/turned.
data 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.
nocalc a logical. if TRUE, the learning procedure is not called. Used if only a random graph is wanted.
timetrace a logical. If TRUE, prints some timing information on the screen.

Details

Given the starting network, a network is created with exactly one arrow added/turned/removed. The arrow is chosen randomly amongst all possibilities. If there are no possibilities, the original network is returned. All networks are learned with the data in df using the prior information in prior. Used by perturb.

Value

A list with two elements

nw an object of class networkfamily with all created networks. All networks have been learned.
trylist an updated list, used internally for reusing learning of nodes, see maketrylist.

Author(s)

Susanne Gammelgaard Bøttcher alma@math.auc.dk,
Claus Dethlefsen dethlef@math.auc.dk.

References

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

See Also

perturb

Examples

data(rats)
fit       <- network(rats,specifygraph=FALSE,inspect=FALSE)
fit.prior <- jointprior(fit,12)
fit       <- learn(fit,rats,fit.prior)$nw
set.seed(10)
rats.extra <- addrandomarrow(fit,rats,fit.prior)$nw
rats.extra <- addrandomarrow(rats.extra,rats,fit.prior)$nw
rats.extra <- turnrandomarrow(rats.extra,rats,fit.prior)$nw
rats.extra <- deleterandomarrow(rats.extra,rats,fit.prior)$nw
plot(rats.extra)

[Package Contents]