[R] cpquery problem

ross.chapman at ecogeonomix.com ross.chapman at ecogeonomix.com
Fri Aug 12 09:24:04 CEST 2016


Hi Marco

 

Thanks again for your comments.

 

First, I used the term "EST = y" in my original query as a shorthand, I have
used the terms "K1", "M1", and "M2" for all actual queries.

 

If I might expand on the outputs I am getting, I have run predict for the
term "ABW" on a data vector with the following values

 

EST M1, TR 9,  FFB 24.625, BN 67549,  NDM 2.75,  PDM 0.156, KDM 0.65, RF
2297, RF.1 3203, RN.2 1939, NPKM 517.8402, NPKM.1 492.8674, NPKM.2 525.6392

I obtain a predicted output of 15.022 for the node ABW, which is good.

 

I then entered the same data into cpquery and with an expected value for ABW
that spans the predicted value as follows:

cpquery(fullFitted,event=((ABW>10) & (ABW<20)), evidence=list(EST = "M1",
TR = 9,

FFB = 24.625,

BN = 67549,

PDM = 0.156,

NDM = 2.75,

KDM = 0.65,

NPKM = 517.8402,

NPKM.2 = 525.6392, 

NPKM.1 = 492.8674,

RF = 2297, 

RF.1 = 3203,

RF.2 = 1939),

n=10^6, method =  "lw")

 

and cpquery returned a probability  of 0.

 

However, if I change the query to a data vector where EST = K1 (EST can take
three values, K1, M1, M2) I get comparable results from predict and cpquery.

 

For example running predict returns a value of 11.382 from the following
values:

 

EST K1, TR 9,  FFB 19.638, BN 95942,  NDM 3,  PDM 0.171, KDM 0.84, RF 2989,
RF.1 2482, RN.2 2169, NPKM 497.2858, NPKM.1 446.3927, NPKM.2 492.6883

In this instance, running a cpquery for an event that spans the predicted
ABW value returns a high probability of 0.73.

cpquery(fullFitted,event=((ABW>10) & (ABW<13)), evidence=list(EST = "K1",
TREEAGE = 9,

FFB = 19.63884,

BN = 95942,

PDM = 0.171,

NDM = 3,

KDM = 0.84,

NPKM = 497.2858,

NPKMg = 492.6883, SUM_NPKMg_IN.1=446.3927,

RN = 2989, 

RF.1 = 2482,

RF.2 = 2169),

n=10^6, method =  "lw")

 

 

I am clearly missing something about the way that cpquery is computed or
deployed.  Can you advise me how I might deconstruct the cpquery analyses to
better understand the results that I am getting?  In particular, I would
like to know why the cpquery is not giving a probability that I expect with
EST = M1.  Is there something wrong with my use of the cpquery function? Are
there steps that I can take to trace the source of the observed behaviour
and perhaps understand the output of the cpquery when EST = M1?

Thanks for your  continued assistance.

Ross

 


	[[alternative HTML version deleted]]



More information about the R-help mailing list