Learn R Programming

pcalg (version 2.7-12)

gmD: Graphical Model Discrete 5-Dim Example Data

Description

This data set contains a matrix containing information on five discrete variables (levels are coded as numbers) and the corresonding DAG model.

Usage

data(gmD)

Arguments

Format

A list of two components

x:

a data.frame with 5 columns X1 .. X5 each coding a discrete variable (aka factor) with interagesInt [1:10000, 1:5] 2 2 1 1 1 2 2 0 2 0 ...

g:

Formal class 'graphNEL' [package "graph"] with 6 slots
.. ..@ nodes : chr [1:5] "1" "2" "3" "4" ...
.. ..@ edgeL :List of 5
........

where x is the data matrix and g is the DAG from which the data were generated.

Details

The data was generated using Tetrad in the following way. A random DAG on five nodes was generated; discrete variables were assigned to each node (with 3, 2, 3, 4 and 2 levels); then conditional probability tables corresponding to the structure of the generated DAG were constructed. Finally, 10000 samples were drawn using the conditional probability tables.

Examples

Run this code
data(gmD)
str(gmD, max=1)
if(require("Rgraphviz"))
  plot(gmD$ g, main = "gmD $ g --- the DAG of the gmD (10'000 x 5 discrete data)")
## >>>  1 --> 3 <-- 2 --> 4 --> 5
str(gmD$x)
## The number of unique values of each variable:
sapply(gmD$x, function(v) nlevels(as.factor(v)))
## X1 X2 X3 X4 X5
##  3  2  3  4  2
lapply(gmD$x, table) ## the (marginal) empirical distributions
## $X1
##    0    1    2
## 1933 3059 5008
##
## $X2
##    0    1
## 8008 1992
##
## $X3
## .....

Run the code above in your browser using DataLab