nutterb / HydeNet

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

Factor Conversion problems in compileJagsModel #36

Closed jarrod-dalton closed 9 years ago

jarrod-dalton commented 9 years ago

I'm trying to set observed values for factor nodes in the PE network, and compileJagsModel() seems to be setting them to NA. I tried using numeric (JAGS-esqe) values for the factor levels (1 and 2), and it sets the node to NA. When I try using R-esqe factor labels ("No" and "Yes"), I get an error.

library(HydeNet) options(Hyde_maxDigits=2) data(PE, package='HydeNet') autoNet <- HydeNetwork(~ wells

compiled.autoNet <- compileJagsModel(autoNet, data=list(wells=7, treat=1), n.chains=3) Compiling model graph Resolving undeclared variables Allocating nodes Graph Size: 53

Initializing model

head(compiled.autoNet$observed, 20) $wells [1] 7

$treat [1] NA

nutterb commented 9 years ago

Just to address the simplest issue, which version of the package are you using?

packageVersion('HydeNet')

If you are running anything less than 0.7.2, reinstall the package with

devtools::install_github("nutterb/HydeNet", ref="development")

Under this version, using data=list(wells=7, treat='No') works, but using treat=1 returns NA. I'll work that out.

jdutch27 commented 9 years ago

I was running 0.7.1. I reinstalled and got the same problem though.

nutterb commented 9 years ago

This will be fixed in 0.7.3.