Learn R Programming

deal (version 1.1-1)

perturb: Perturb a network

Description

Randomly insert/delete/turn arrows to obtain another network

Usage

perturb(nw,data,prior,degree=nw$n,trylist=rep(list(NULL),nw$n),nocalc=FALSE,timetrace=TRUE,smalldf=NA)

Arguments

nw
The network from which arrows are added/removed/turned.
data
Dataframe used for learning the network.
prior
A joint prior. See jointprior().
degree
The number of attempts to randomly insert/remove/turn an arrow.
trylist
Used internally for reusing learning of nodes.
nocalc
If T, the network score is not updated
timetrace
Timing information available.
smalldf
Used for analysing networks with time-varying nodes.

Value

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

Details

Given the starting network, a new network is constructed by randomly choosing an action: remove, turn, add. After the action is chosen, we choose randomly among all possibilities of that action. If there are no possibilites, the unchanged network is returned.

References

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

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
fit.new   <- perturb(fit,rats,fit.prior,degree=10)$nw

Run the code above in your browser using DataLab