[R] [Q] Bayeisan Network with the "deal" package
Spencer Graves
spencer.graves at pdf.com
Thu Apr 20 19:52:10 CEST 2006
Thanks for providing such a simple, complete example. I've never
used "deal" before, but a few minutes with your example led me to
something that might help you:
First, the documentation for "localprior" says, "x: an object of
class 'node' or 'network'." That information led me to checking
'class(ksl)' and 'class(ksl$node[1])': The first is class 'network',
while the second is of class 'list'.
However, class(ksl$node[[1]]) is of class 'node'. Bingo:
> localprior(ksl.nw$nodes[[1]])
[[1]]
[[1]]$alpha
[1] NA
[[1]]$nu
[1] 64
[[1]]$rho
[1] 64
[[1]]$mu
[1] 179.289
[[1]]$phi
[,1]
[1,] 113442.3
[[1]]$tau
[1] 64
hope this helps.
spencer graves
Young-Jin Lee wrote:
> Dear R-users
>
> I am looking for a help in using the "deal" package.
> I followed the manual and paper from the author's web site to learn it, as
> shown below, but I could not figure out how to access the local and
> posterior probability of the nodes in the constructed network.
>
> library(deal)
> data(ksl)
> ksl.nw <- network(ksl)
> ksl.prior <- jointprior(ksl.nw)
> banlist <- matrix(c(5,5,6,6,7,7,9,
> 8,9,8,9,8,9,8), ncol = 2)
> ksl.nw$banlist <- banlist
> ksl.nw <- learn(ksl.nw, ksl, ksl.prior)$nw
>
> According to the manual, the local prior and posterior can be accessed for
> each node using localprior()
> and localposterior(). However, I got null from localprior(ksl.nw$nodes[1])
> and localposterior(ksl.nw$nodes[1]).
> Can anyone tell me what I should do to access the local prior and posterior?
>
> Any help would be appreciated.
> Thanks in advance.
>
> Young-Jin
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
More information about the R-help
mailing list