setNodeModels: Set Node Properties Using Model Objects

Description Usage Arguments Author(s) Examples

View source: R/setNodeModels.R

Description

Set node properties using pre-defined model objects. Model objects may be imported from other programs, but need to be valid model objects with the additional restriction that the responses and independent variables must be named nodes in the network. This will NOT create a network from a list of models. For that, see HydeNetwork

Usage

1
setNodeModels(network, ...)

Arguments

network

A HydeNetwork object

...

Model objects to be incorporated into network

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
data(PE, package="HydeNet")
Net <- HydeNetwork(~ wells + 
                     pe | wells + 
                     d.dimer | pregnant*pe + 
                     angio | pe + 
                     treat | d.dimer*angio + 
                     death | pe*treat) 
print(Net)

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")

Net2 <- setNodeModels(Net, g1, g2, g3, g4, g5, g6, g7) 
print(Net)

writeNetworkModel(Net, pretty=TRUE)

Example output

Loading required package: nnet
A Probabilistic Graphical Network
Has data attached: No

wells
dnorm(mu = Unspecified, tau = Unspecified)
: wells ~ 1

pe | wells
dnorm(mu = Unspecified, tau = Unspecified)
: pe ~ wells

d.dimer | pe * pregnant
dnorm(mu = Unspecified, tau = Unspecified)
: d.dimer ~ pe + pregnant

pregnant
dnorm(mu = Unspecified, tau = Unspecified)
: pregnant ~ 1

angio | pe
dnorm(mu = Unspecified, tau = Unspecified)
: angio ~ pe

treat | d.dimer * angio
dnorm(mu = Unspecified, tau = Unspecified)
: treat ~ d.dimer + angio

death | pe * treat
dnorm(mu = Unspecified, tau = Unspecified)
: death ~ pe + treat
A Probabilistic Graphical Network
Has data attached: No

wells
dnorm(mu = Unspecified, tau = Unspecified)
: wells ~ 1

pe | wells
dnorm(mu = Unspecified, tau = Unspecified)
: pe ~ wells

d.dimer | pe * pregnant
dnorm(mu = Unspecified, tau = Unspecified)
: d.dimer ~ pe + pregnant

pregnant
dnorm(mu = Unspecified, tau = Unspecified)
: pregnant ~ 1

angio | pe
dnorm(mu = Unspecified, tau = Unspecified)
: angio ~ pe

treat | d.dimer * angio
dnorm(mu = Unspecified, tau = Unspecified)
: treat ~ d.dimer + angio

death | pe * treat
dnorm(mu = Unspecified, tau = Unspecified)
: death ~ pe + treat
model{
   wells ~ dnorm(Unspecified, Unspecified)
   pe ~ dnorm(Unspecified, Unspecified)
   d.dimer ~ dnorm(Unspecified, Unspecified)
   pregnant ~ dnorm(Unspecified, Unspecified)
   angio ~ dnorm(Unspecified, Unspecified)
   treat ~ dnorm(Unspecified, Unspecified)
   death ~ dnorm(Unspecified, Unspecified)
}

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