Learn R Programming

pcalg (version 2.0-3)

gmL: Latent Variable 4-Dim Graphical Model Data Example

Description

This data set contains a matrix containing information on four gaussian variables and the corresonding DAG model containing four observed and one latent variable.

Usage

data(gmL)

Arguments

source

## Used to generate "gmL" set.seed(47) p <- 5 n <- 10000 gGtrue <- randomDAG(p, prob = 0.3) ## true DAG myX <- rmvDAG(n, gGtrue) colnames(myX) <- as.character(1:5) gmL <- list(x = myX[,-1], g = gGtrue)

Details

The data was generated as indicated below. First, a random DAG model was generated with five nodes; then 10000 samples were drawn from this model; finally, variable one was declared to be latent and the corresponding column was deleted from the simulated data set.

Examples

Run this code
data(gmL)
str(gmL, max=3)

## the graph:
gmL$g
graph::nodes(gmL$g) ; str(graph::edges(gmL$g))
if(require("Rgraphviz"))
  plot(gmL$g, main = "gmL $ g -- latent variable example data")

pairs(gmL $x) # the data

Run the code above in your browser using DataLab