Closed jdutch27 closed 9 years ago
We'll need to discuss this. I did not intend for these to be called by the user, so they work seamlessly when called within Hyde, but not so well in the Global Environment.
The following produces what you are looking for
g <- glm(treat ~ d.dimer*angio, data=PE, family="binomial")
Hyde:::writeJagsFormula(g)
But the intended behavior would be
setNode(net, treat,
nodeFitter='glm',
fitterArgs = list(family='binomial'),
p = fromFormula())
After the node is properly defined, writeNetworkModel
will call writejagsFormula
if it is needed and it will all be handled internally.
If you want, we can export these functions and make them available to the user, but I am not sure of the value of doing so (so you'll have to persuade me).
These two statements are equivalent
equation <- "-6.3 + 0.02*d.dimer + 2.9*angio - 0.005*d.dimer*angio"
net <- setNode(net, treat, nodeType="dbern",
p=paste("ilogit(", equation, ")"),
validate=FALSE)
equation <- "-6.3 + 0.02*d.dimer + 2.9*angio - 0.005*d.dimer*angio"
net <- setNode(net, treat, nodeType="dbern",
nodeFormula=treat ~ ilogit(-6.3 + 0.02*d.dimer + 2.9*angio - 0.005*d.dimer*angio),
p=fromFormula())
These functions seem to be buggy.
I think just a little bit of work on the methods is what is needed? The function works when you explicitly tell it you have a glm object.