add_arcs {gmgm}R Documentation

Add arcs to a Gaussian mixture graphical model

Description

This function adds arcs to a Gaussian mixture graphical model. For each added arc, a variable related to the start node is added to the Gaussian mixture model describing the local distribution over the end node and its parents, with mean 0 and variance 1 for each mixture component.

Usage

add_arcs(gmgm, arcs)

Arguments

gmgm

An object of class gmbn or gmdbn.

arcs

A data frame containing the added arcs. The column from describes the start node, the column to the end node and the column lag the time lag between them. Missing values in from or to are interpreted as "all possible nodes", which allows to quickly define large set of arcs that share common attributes. Missing values in lag are replaced by 0. If gmgm is a gmdbn object, the same arcs are added to each of its gmbn elements. This constraint can be overcome by passing a list of data frames named after some of these elements (b_1, ...) and containing arcs specifically added to them. The arcs whose time lags exceed the maximum temporal depth of their gmbn element are not taken into account.

Value

The gmbn or gmdbn object after adding the arcs.

See Also

add_nodes, relevant, remove_arcs, remove_nodes, rename_nodes

Examples

data(gmbn_body)
gmbn_1 <- add_arcs(gmbn_body,
                   data.frame(from = c("GENDER", "AGE"),
                              to = c("GLYCO", "WEIGHT")))

data(gmdbn_air)
gmdbn_1 <- add_arcs(gmdbn_air,
                    list(b_2 = data.frame(from = "WIND", to = "NO2", lag = 1),
                         b_13 = data.frame(from = c("NO2", "NO2"),
                                           to = c("O3", "O3"), lag = c(0, 1))))


[Package gmgm version 1.1.2 Index]