[R] cpquery problem

Marco Scutari marco.scutari at gmail.com
Wed Aug 10 10:35:27 CEST 2016


Hi Ross,

On 4 August 2016 at 09:37, Ross Chapman <ross.chapman at ecogeonomix.com> wrote:
> The network that I am working on has the following coefficients for the
> node that I am interested in (ABW):
>
>   Parameters of node ABW (conditional Gaussian distribution)
>
> Conditional density: ABW | EST + TR + FFB + RF
> Coefficients:
>                         0             1             2
> (Intercept)  -0.480612729 -5.834617332   0.809011487
> TR       1.857271045   1.584331230   1.964198638
> FFB    0.182533645   0.066891147   0.028620951
> RF     -0.002822838   0.002155205  -0.001608243
>
> Standard deviation of the residuals:
>         0          1          2
> 1.5140402  1.1764351  0.9675918
> Discrete parents' configurations:
>      EST
> 0     K1
> 1     M1
> 2     M2

This puzzles me: EST can take values "K1", "M1" and "M2", so why did
your original query have EST == "y"? That does not seem to be a valid
value.

> However, running cpquery() using the values for this test case returns a
> conditional probability of 0 for all levels of ABW observed in the training
> data.

> Why does cpquery not return a high conditional probability for an event
> which is predicted from the same coefficients?

predict() performs a maximum a posteriori prediction conditional on
all the variables in the data, while your query only conditions on 3-4
variables; it is not surprising that results may differ. Conditioning
on he whole Markov blanket of the variable you are predicting should
give you results that are more comparable.

Also, you should consider that with if you substitute the values you
are conditioning on in your query in the regression equations you
showed above, I get an average an average of ~= 13 without considering
FFB. If I assume FFB is positive, then I can easily see E(y) ~= 15 and
E(y) - 1.96 * 0.96 s.d. ~= 13.5. So ABW < 11 has zero or almost zero
probability mass.

Cheers,
    Marco

-- 
Marco Scutari, Ph.D.
Lecturer in Statistics, Department of Statistics
University of Oxford, United Kingdom



More information about the R-help mailing list