Write the JAGS Formula for a Hyde Node
Based on the information provided about the node, an appropriate JAGS model is written in text. This is combined with the other node models to generate the complete network.
writeJagsFormula(fit, nodes, ...) ## S3 method for class 'cpt' writeJagsFormula(fit, nodes, ...) ## S3 method for class 'glm' writeJagsFormula(fit, nodes, bern = bern, ...) ## S3 method for class 'lm' writeJagsFormula(fit, nodes, bern, ...) ## S3 method for class 'multinom' writeJagsFormula(fit, nodes, bern = bern, ...) ## S3 method for class 'survreg' writeJagsFormula(fit, ..., bern = bern) ## S3 method for class 'xtabs' writeJagsFormula(fit, ...)
fit |
a model object |
nodes |
a vector of node names, usually passed from |
... |
Additional arguments to be passed to other methods |
bern |
a vector of bernoulli node names |
Methods for different model objects can be written so that this function can be extended as desired.
The resulting formulas are based on the coefficient matrix of the fitted model, and the returned result is the JAGS code representing the regression equation of the model.
In the writeJagsFormula.glm
method, appropriate transformations
exist for the following combinations:
family = binomial; link = logit
family = poisson; link = log
family = gaussian; link = identity (calls writeJagsFormula.lm
)
Jarrod Dalton and Benjamin Nutter
data(PE, package="HydeNet") fit <- lm(d.dimer ~ pregnant + pe, data=PE) writeJagsFormula(fit, nodes=c("d.dimer", "pregnant", "pe")) fit.glm <- glm(death ~ pe + treat, data=PE, family="binomial") writeJagsFormula(fit.glm, nodes=c("death", "pe", "treat"))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.