Learn R Programming

deal (version 1.1-2)

addrandomarrow: Adding/Turning/Removing random arrows

Description

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

Usage

addrandomarrow(nw,data,prior,trylist=rep(list(NULL),nw$n),nocalc=FALSE,
               timetrace=FALSE,smalldf=NA)
turnrandomarrow(nw,data,prior,trylist=rep(list(NULL),nw$n),nocalc=FALSE,
               timetrace=FALSE,smalldf=NA)
deleterandomarrow(nw,data,prior,trylist=rep(list(NULL),nw$n),nocalc=FALSE,
               timetrace=timetrace,smalldf=NA)

Arguments

nw
The network from which arrows are added/removed/turned.
data
Dataframe used for learning the network, see network.
prior
A joint prior, see jointprior.
trylist
Used internally for reusing learning of nodes, see maketrylist.
nocalc
Do not call the learning procedure if TRUE. Used if only a random graph is wanted.
timetrace
If TRUE, prints some timing information on the screen.
smalldf
Used for analysing networks with time-varying nodes, see timeslice.

Value

  • A list with two elements
  • nwA networkfamily with all created networks.
  • trylistUpdated.

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. Used in perturb.

References

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

See Also

perturb

Examples

Run this code
data(rats)
fit       <- network(rats,specifygraph=FALSE,inspect=FALSE)
fit.prior <- jointprior(fit,12)
fit       <- learn(fit,rats,fit.prior)$nw
rats.extra <- addrandomarrow(fit,rats,fit.prior)$nw
plot(rats.extra)

Run the code above in your browser using DataLab