nutterb / HydeNet

Hybrid Decision Networks in R
Other
23 stars 3 forks source link

Adding observed nodes to compileDecisionModel() #92

Closed jarrod-dalton closed 8 years ago

jarrod-dalton commented 9 years ago

Right now, compileDecisionModel() forbids adding a data argument as is done in compileJagsModel() when nodes are observed.

  g <- HydeNetwork(~ CAD | Age * Sex * ChestPainType
                   + stressTestResult | do.stressTest * CAD
                   + ekgResult        | do.ekg * CAD
                   + echoResult       | do.echo * CAD
                   + ctaResult        | do.cta * CAD
                   + testCosts | do.stressTest * do.ekg
                                 * do.echo * do.cta)

<< setNode, etc... >>>

  cg <- compileDecisionModel(g, data=list(Age=71, Sex="Male", ChestPainType="Typical"))
Error: 
makePolicyMatrix(network, policyMatrix, Check)
1: 'data' is not an accepted argument in 'compileDecisionModel'
nutterb commented 9 years ago

I"m pretty sure that was a design decision at the time, and is easily overcome by adding a constant column to the policy matrix. But I can see why you'd want this, and it would be the only way to observe a node if you wanted to use the default policy matrix.

Question: should we allow decision nodes to be observed? If yes, should we disallow a node to appear in both policyMatrix and data?

jarrod-dalton commented 9 years ago

Yes we should allow decision nodes to be observed. Disallowing values in both the policy matrix and data list seems reasonable although I can't fully wrap my head around the ramifications of that vs. simply overriding the values in the policy matrix. This is not unrelated to the consideration of allowing deterministically defined decision nodes.

nutterb commented 8 years ago

This is included in version 0.10.0