tempfile.R

require(gRain)
temp_fn <- function(){
V1<-cptable(~V1, values=c(0.480822,0.519178), levels=c('absent', 'present'))
V2<-cptable(~V2, values=c(0.2977035,0.7022965), levels=c('absent', 'present'))
V3<-cptable(~V3, values=c(0.4843905,0.5156095), levels=c('absent', 'present'))
V4<-cptable(~V4, values=c(0.3124602,0.6875398), levels=c('absent', 'present'))
V5<-cptable(~V5, values=c(0.2790582,0.7209418), levels=c('absent', 'present'))
V6<-cptable(~V6, values=c(0.3694144,0.6305856), levels=c('absent', 'present'))
V7<-cptable(~V7|V1+V2+V3+V4+V5+V6, values=c(0.9,0.1,0.7878559,0.2121441,0.7878559,0.2121441,0.6757119,0.3242881,0.7878559,0.2121441,0.6757119,0.3242881,0.6757119,0.3242881,0.5635678,0.4364322,0.7878559,0.2121441,0.6757119,0.3242881,0.6757119,0.3242881,0.5635678,0.4364322,0.6757119,0.3242881,0.5635678,0.4364322,0.5635678,0.4364322,0.4514237,0.5485763,0.7878559,0.2121441,0.6757119,0.3242881,0.6757119,0.3242881,0.5635678,0.4364322,0.6757119,0.3242881,0.5635678,0.4364322,0.5635678,0.4364322,0.4514237,0.5485763,0.6757119,0.3242881,0.5635678,0.4364322,0.5635678,0.4364322,0.4514237,0.5485763,0.5635678,0.4364322,0.4514237,0.5485763,0.4514237,0.5485763,0.3392796,0.6607204,0.3392796,0.6607204,0.2271356,0.7728644,0.2271356,0.7728644,0.1149915,0.8850085,0.2271356,0.7728644,0.1149915,0.8850085,0.1149915,0.8850085,0.00284740000000006,0.9971526,0.2271356,0.7728644,0.1149915,0.8850085,0.1149915,0.8850085,0.00284740000000006,0.9971526,0.1149915,0.8850085,0.00284740000000006,0.9971526,0.00284740000000006,0.9971526,0,1,0.2271356,0.7728644,0.1149915,0.8850085,0.1149915,0.8850085,0.00284740000000006,0.9971526,0.1149915,0.8850085,0.00284740000000006,0.9971526,0.00284740000000006,0.9971526,0,1,0.1149915,0.8850085,0.00284740000000006,0.9971526,0.00284740000000006,0.9971526,0,1,0.00284740000000006,0.9971526,0,1,0,1,0,1), levels=c('absent', 'present'))
plist<-compileCPT(list(V1,V2,V3,V4,V5,V6,V7))
BN<-grain(plist)
Results_tmp<-querygrain(BN)
return(Results_tmp)
}
cjcarlson/elton documentation built on Oct. 28, 2018, 3:21 a.m.