HydeNetwork: Define a Probablistic Graphical Network

Description Usage Arguments Details Value Author(s) Examples

View source: R/HydeNetwork.R

Description

Using either a directed acyclic graph (DAG) or a list of models, define a probabilistic graphical network to serve as the basis of building a model.

Usage

1
2
3
4
5
6
7
HydeNetwork(nodes, ...)

## S3 method for class 'formula'
HydeNetwork(nodes, data = NULL, ...)

## S3 method for class 'list'
HydeNetwork(nodes, ...)

Arguments

nodes

Either a formula that defines the network or a list of model objects.

...

additional arguments to other methods. Not currently used.

data

A data frame with the data for estimating node parameters.

Details

The DAG becomes only one element of the object returned by HydeNetwork. The dag object is used to extract the node names and a list of parents for each node. These will be used to help quantify the relationships.

When given a formula, the relationships are defined, but are not quantified until writeNetworkModel is called.

When a list of models is given, rather than refitting models when writeNetworkModel is called, the quantified relationships are placed into the object.

Value

Returns an object of class HydeNetwork. The object is really just a list with the following components:

@note These objects can get pretty large. In versions of R earlier than 3.2, it can take a while to print the large network objects if you simply type the object name into the console. It is recommended that you always explicitly invoke the 'print' function (ie, print(Net) instead of just Net) to save yourself some valuable time.

Author(s)

Jarrod Dalton and Benjamin Nutter

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#* Formula Input
Net <- HydeNetwork(~ wells + 
                     pe | wells + 
                     d.dimer | pregnant*pe + 
                     angio | pe + 
                     treat | d.dimer*angio + 
                     death | pe*treat,
                     data = PE) 
print(Net)

#* Model Input
g1 <- lm(wells ~ 1, data=PE)
g2 <- glm(pe ~ wells, data=PE, family="binomial")
g3 <- lm(d.dimer ~ pe + pregnant, data=PE)
g4 <- xtabs(~ pregnant, data=PE)
g5 <- glm(angio ~ pe, data=PE, family="binomial")
g6 <- glm(treat ~ d.dimer + angio, data=PE, family="binomial")
g7 <- glm(death ~ pe + treat, data=PE, family="binomial")

bagOfModels <- list(g1,g2,g3,g4,g5,g6,g7)

bagNet <- HydeNetwork(bagOfModels)
print(bagNet)

HydeNet documentation built on July 8, 2020, 5:15 p.m.