sparsebnFit: sparsebnFit class

Description Usage Arguments Details Slots Methods Examples

View source: R/s3-generics.R

Description

Main class for representing DAG estimates. Represents a single DAG estimate in a solution path.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
sparsebnFit(x)

is.sparsebnFit(x)

## S3 method for class 'sparsebnFit'
print(x, maxsize = 20, ...)

## S3 method for class 'sparsebnFit'
summary(object, ...)

## S3 method for class 'sparsebnFit'
plot(x, ...)

Arguments

x

A list or an object of type sparsebnFit. Should only be used internally.

maxsize

If the number of nodes in a graph is maxsize, then the entire graph is printed to screen, otherwise a short summary is displayed instead.

...

(optional) additional arguments.

object

an object of type sparsebnFit

Details

This is the main class for storing and manipulating the output of estimate.dag. The main slot of interest is edges, which stores the graph as an edgeList object. If desired, this slot can be changed to hold a graphNEL, igraph, or network object if desired (see setGraphPackage). For anything beyond simply inspecting the graph, it is recommended to use one of these packages.

Since edgeLists do not contain information on the node names, the second slot nodes stores this information. The indices in edges are in one-to-one correspondence with the names in the nodes vector. The lambda slot stores the regularization parameter used to estimate the graph.

Other slots include nedge, for the number of edges; pp, for p = number of nodes; nn, for n = number of samples, and time, for the time in seconds needed to estimate this graph. Note that these slots are mainly for internal use, and in particular it is best to query the number of nodes via num.nodes, the number of edges via num.edges, and the number of samples via num.samples.

By default, only small graphs are printed, but this behaviour can be overridden via the maxsize argument to print. To view a list of parents for a specific subset of nodes, use show.parents.

Generally speaking, it should not be necessary to construct a sparsebnFit object manually. Furthermore, these estimates should always be wrapped up in a sparsebnPath object, but can be handled separately if desired (be careful!).

Slots

edges

(edgeList) Edge list of estimated DAG (see edgeList).

nodes

(character) Vector of node names.

lambda

(numeric) Value of lambda for this estimate.

nedge

(integer) Number of edges in this estimate.

pp

(integer) Number of nodes.

nn

(integer) Number of observations this estimate was based on.

time

(numeric) Time in seconds to generate this estimate.

Methods

get.adjacency.matrix, num.nodes, num.edges, num.samples, show.parents

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## Not run: 
### Learn the cytometry network
library(sparsebn)
data(cytometryContinuous) # from the sparsebn package
cyto.data <- sparsebnData(cytometryContinuous[["data"]], type = "continuous")
cyto.learn <- estimate.dag(cyto.data)

### Inspect the output
class(cyto.learn[[1]])
print(cyto.learn[[2]])
show.parents(cyto.learn[[1]], c("raf", "mek", "plc"))

### Manipulate a particular graph
cyto.fit <- cyto.learn[[7]]
num.nodes(cyto.fit)
num.edges(cyto.fit)
show.parents(cyto.fit, c("raf", "mek", "plc"))
plot(cyto.fit)

### Use graph package instead of edgeLists
setGraphPackage("graph", coerce = TRUE) # set sparsebn to use graph package
cyto.edges <- cyto.fit$edges
degree(cyto.edges)       # only available with graph package
isConnected(cyto.edges)  # only available with graph package

## End(Not run)

sparsebnUtils documentation built on Jan. 27, 2021, 9:05 a.m.