sample_MoTBFs {MoTBFs}R Documentation

Sample generation from conditional MoTBFs

Description

This function generates a sample from conditional MoTBFs.

Usage

sample_MoTBFs(bn, dag, obs = NULL, size, force_size = T)

Arguments

bn

A list of lists obtained from the function MoTBFs_Learning.

dag

An object of class "bn", representing the directed acyclic graph.

obs

A data.frame containing the observed variables. This argument can be omitted if no variable is observed.

size

A non-negative integer giving the number of instances to be generated.

force_size

logical indicating if the sample must be of the size indicated. As a default, it is set to TRUE.

Value

A data.frame containing the generated sample.

Examples


## Dataset
  data("ecoli", package = "MoTBFs")
  data <- ecoli[,-c(1,9)]

## Get directed acyclic graph
  dag <- LearningHC(data)
  
## Learn bayesian network
  bn <- MoTBFs_Learning(dag, data = data, numIntervals = 4, POTENTIAL_TYPE = "MTE")
  
## Specify the evidence set 
  obs <- data.frame(lip = "0.48", alm1 = 0.55, gvh = 1, stringsAsFactors=FALSE)
  
## Get the conditional sample
  sample_MoTBFs(bn, dag, obs, size = 10)
  

[Package MoTBFs version 1.4.1 Index]