Learn R Programming

ess: Efficient Stepwise Selection in Decomposable Models

About ess

The ess package is an R implementation of the algorithm presented in this paper and later corrected slightly in this paper. The ESS algorithm is used for model selection in discrete decomposable graphical models. It is fast compared to other model selection procedures in R, especially when data is high-dimensional.

Decomposable Graphical Models

The class of graphical models is a family of probability distributions for which conditional dependencies can be read off from a graph. If the graph is decomposable, the maximum likelihood estimates of the parameters in the model can be shown to be on exact form. This is what enables ESS to be fast and efficient.

Installation

You can install the current stable release of the package by using the devtools package:

devtools::install_github("mlindsk/ess", build_vignettes = FALSE)

Getting Started

The main function in ess is fit_graph which fits a decomposable graph. An object returned from fit_graph is a gengraph object. fit_graph has four types; forward selection (fwd), backward selection (bwd), tree (tree) and a combination of tree and forward (tfwd). Using adj_lst on an object returned by fit_graph gives the adjacency list corresponding to the graph. Similarly one can use adj_mat to obtain an adjacency matrix.

A neat usecase of ess is that of variable selection. Consider the built-in data derma (dermatitis) with class variable ES. We can fit a graph structure to this data, and inspect the graph to see which variables ES directly depends upon:

library(ess)
g <- fit_graph(derma)
plot(g, vertex.size = 1)

Instead of inspecting the graph (it can be difficult if there are many variables) we can simply extract the neighbors of ES

adj <- adj_lst(g)
adj$ES
#>  [1] "h21" "h20" "h28" "h33" "h16" "h29" "c9"  "h15" "h14" "c5"  "c3"  "h19"
#> [13] "h26" "c4"  "age" "c7"  "c2"  "h31" "c1"  "h18" "h17" "h32" "c11" "h13"
#> [25] "h23" "c10" "h22" "h24" "h30" "h27"

For more information, see the documentation. E.g. type ?fit_graph in an R session.

See Also

The molic package is used for outlier detection in categorical data and is designed to work with gengraph objects. One can use ess to fit a gengraph object, extract the adjacency matrix, conert it to an igraph object and use it in connection with belief propagation via the jti package.

Copy Link

Version

Install

install.packages('ess')

Monthly Downloads

225

Version

1.1.2

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Mads Lindskou

Last Published

May 31st, 2021

Functions in ess (1.1.2)

adj_mat

Adjacency Matrix
as_adj_mat

Converts an adjacency list to an adjacency matrix
as_igraph

Gengraph as igraph
derma

Dermatology Database
adj_lst

Adjacency List
as_adj_lst

Converts an adjacency matrix to an adjacency list
dgm_sim_from_graph

Simulate observations from a decomposable graphical model
dfs

Depth First Search
components

Finds the components of a graph
entropy

Joint Entropy
make_null_graph

Make a null graph
gengraph

A generic and extendable structure for decomposable graphical models
walk.fwd

Stepwise efficient forward selection in decomposable graphical models
fit_graph

Fit a decomposable graphical model
walk.bwd

Stepwise backward selection
is_decomposable

A test for decomposability in undirected graphs
make_complete_graph

Make a complete graph
print.gengraph

Print
walk

Stepwise model selection
plot.gengraph

Plot
subgraph

Subgraph
ess-package

ess: Eficient Stepwise Selection in Decomposable Models
fit_components

Fit a decomposable graphical model on each component
print.tree

Print
mcs

Maximum Cardinality Search
rip

Runnining Intersection Property