BNET Procedure
Guiding Network
As you review the network, you notice that Pain is the parent of Age. Given the data, there is a strong relationship between Age and Pain that explains this connection, but the direction is not as desired. You can use the INNETWORK= option as in the following statements to guide the network so that both Treatment and Age become parents of Pain:
Data Innetwork;
length parent $ 10;
input Parent $ Child $ Flag;
datalines;
Treatment Pain 1
Age Pain 1
data mylib.innetwork;
set innetwork;
run;
proc bnet data=mylib.neuralgia numbin=3 outnetwork=mylib.network
innetwork=mylib.innetwork;
target Pain;
input Treatment Sex/level=nominal;
input Age Duration/level=interval;
ods output varselect=varselect;
run;
proc print data=mylib.network noobs label;
var _parentnode_ _childnode_;
where _type_="STRUCTURE";
run;
The revised network is as desired, with Treatment and Age as parents of Pain, as shown in Figure 4.
Figure 4: Structure with INNETWORK= Option
| Parent Node | Child Node |
|---|---|
| Treatment | Pain |
| Age | Pain |
You can get the revised conditional probabilities associated with this network by running the following code:
proc print data=mylib.network noobs label;
var _parentnode_ _parentcond_ _childnode_ _childcond_ _value_;
where _type_="PROBABILITY";
run;
Figure 5 shows the revised conditional probabilities, given this network.
Figure 5: Probability Table with INNETWORK= Option
| Parent Node | Parent Condition | Child Node | Child Condition | Value |
|---|---|---|---|---|
| Treatment | A | 0.33333 | ||
| Treatment | B | 0.33333 | ||
| Treatment | P | 0.33333 | ||
| Age | <67 | 0.25397 | ||
| Age | <75 | 0.50794 | ||
| Age | >=75 | 0.23810 | ||
| Treatment | A | Pain | Yes | 0.14286 |
| Age | <67 | Pain | Yes | 0.14286 |
| Treatment | A | Pain | No | 0.85714 |
| Age | <67 | Pain | No | 0.85714 |
| Treatment | A | Pain | Yes | 0.21429 |
| Age | <75 | Pain | Yes | 0.21429 |
| Treatment | A | Pain | No | 0.78571 |
| Age | <75 | Pain | No | 0.78571 |
| Treatment | A | Pain | Yes | 0.80000 |
| Age | >=75 | Pain | Yes | 0.80000 |
| Treatment | A | Pain | No | 0.20000 |
| Age | >=75 | Pain | No | 0.20000 |
| Treatment | B | Pain | Yes | 0.14286 |
| Age | <67 | Pain | Yes | 0.14286 |
| Treatment | B | Pain | No | 0.85714 |
| Age | <67 | Pain | No | 0.85714 |
| Treatment | B | Pain | Yes | 0.10000 |
| Age | <75 | Pain | Yes | 0.10000 |
| Treatment | B | Pain | No | 0.90000 |
| Age | <75 | Pain | No | 0.90000 |
| Treatment | B | Pain | Yes | 0.66667 |
| Age | >=75 | Pain | Yes | 0.66667 |
| Treatment | B | Pain | No | 0.33333 |
| Age | >=75 | Pain | No | 0.33333 |
| Treatment | P | Pain | Yes | 0.71429 |
| Age | <67 | Pain | Yes | 0.71429 |
| Treatment | P | Pain | No | 0.28571 |
| Age | <67 | Pain | No | 0.28571 |
| Treatment | P | Pain | Yes | 0.61538 |
| Age | <75 | Pain | Yes | 0.61538 |
| Treatment | P | Pain | No | 0.38462 |
| Age | <75 | Pain | No | 0.38462 |
| Treatment | P | Pain | Yes | 0.83333 |
| Age | >=75 | Pain | Yes | 0.83333 |
| Treatment | P | Pain | No | 0.16667 |
| Age | >=75 | Pain | No | 0.16667 |