Learn R Programming

gRain (version 0.8.1)

simulate.grain: Simulate from an independence network

Description

Simulate data from an independence network.

Usage

## S3 method for class 'grain':
simulate(object, nsim = 1, seed = NULL, ...)

Arguments

object
An inpendence network
nsim
Number of cases to simulate
seed
An optional integer controlling the random number generatation
...
Not used...

Value

  • A data frame

Examples

Run this code
tf <- system.file("huginex", "chest_clinic.net", package = "gRain")
chest <- loadHuginNet(tf, details=1)

simulate(chest,n=10)

chest2 <- setFinding(chest, c("VisitToAsia", "Dyspnoea"),
c("yes","yes"))

simulate(chest2,n=10)

Run the code above in your browser using DataLab