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]]
Dear Ross, On Friday, 3 June 2016, <ross.chapman at ecogeonomix.com <javascript:_e(%7B%7D,'cvml','ross.chapman at ecogeonomix.com');>> wrote:> > I find that repeating the command gives very different results for the > sameset of evidence. Some variability in the results is expected since they are Monte Carlo estimates. What is happening in your case is, I think, that your evidence has a very low probability (since it is so complex) and thus you need to generate more particles to obtain a reasonably precise estimate of that conditional probability. For such a small network cpquery() can easily generate, say, 10^7 particles in a few seconds. 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. >For your query, the default logic sampling is the only option - likelihood weighting does not currently support unbounded intervals in the evidence. Cheers, Marco -- Marco Scutari, Ph.D. Lecturer in Statistics, Department of Statistics University of Oxford, United Kingdom [[alternative HTML version deleted]]