[R] bnlearn cpquery
ross.chapman at ecogeonomix.com
ross.chapman at ecogeonomix.com
Fri Jun 3 02:42:36 CEST 2016
Hi all
I have created a Bayes network with 14 nodes using the bnlearn package and
want to explore the conditional probabilities for specific node with a given
set of evidence using the cpquery() command.
I find that repeating the command gives very different results for the same
set of evidence.
Below are four examples of the same query that gives three very different
outputs.
> cpquery(expNetFitted, event=(out>=24), evidence=(RN>2900 & EST=="K1" &
SMG=="C" & BN>1000 & FRT>460 & HI>13 &FRT.1>450 & FRT.2>450 & RN.1 > 2500 &
RN.2 > 2400 & HI.1>13 & HI.2>13 & FFB.1 >19 & FFB.2 >20 ))
[1] 0.6
> cpquery(expNetFitted, event=(out>=24), evidence=(RN>2900 & EST=="K1" &
SMG=="C" & BN>1000 & FRT>460 & HI>13 &FRT.1>450 & FRT.2>450 & RN.1 > 2500 &
RN.2 > 2400 & HI.1>13 & HI.2>13 & FFB.1 >19 & FFB.2 >20 ))
[1] 0.1428571
> cpquery(expNetFitted, event=(out>=24), evidence=(RN>2900 & EST=="K1" &
SMG=="C" & BN>1000 & FRT>460 & HI>13 &FRT.1>450 & FRT.2>450 & RN.1 > 2500 &
RN.2 > 2400 & HI.1>13 & HI.2>13 & FFB.1 >19 & FFB.2 >20 ))
[1] 0.4285714
> cpquery(expNetFitted, event=(out>=24), evidence=(RN>2900 & EST=="K1" &
SMG=="C" & BN>1000 & FRT>460 & HI>13 &FRT.1>450 & FRT.2>450 & RN.1 > 2500 &
RN.2 > 2400 & HI.1>13 & HI.2>13 & FFB.1 >19 & FFB.2 >20 ))
[1] 0.1666667
Can you please advise me what is happening with these queries and why the
results is so variable and if there are other options for generating
conditional probabilities with bnlearn.
Thanks in advance.
Ross
[[alternative HTML version deleted]]
More information about the R-help
mailing list