Commit c798daef authored by Chris Jewell's avatar Chris Jewell
Browse files

Fixed non-specification of base distribution rate and shape parameters in DirichletProcessNode.

parent 98dfd922
......@@ -347,7 +347,7 @@ DirichletNode <- R6::R6Class(
#' base distribution \code{base}. Base should be a distribution function (dnorm, dgamma, etc) whose parameters
#' are specified in \code{...}.}
#' }
DirichletProcessNode <- R6::R6Class(
DirichletProcessNode <- R6::R6Class( # TODO: Make this accept a generic base distribution, not just Gamma
"DirichletProcessNode",
inherit = StochasticNode,
public = list(
......@@ -355,10 +355,14 @@ DirichletProcessNode <- R6::R6Class(
s = NA,
base = NA,
conc = NA,
initialize = function(theta, s, alpha, base, ..., name) {
baseShape = NA,
baseRate = NA,
initialize = function(theta, s, alpha, base, shape, rate, name) {
super$initialize(name = name)
self$conc <- alpha
self$base <- base
self$base <- dgamma
self$baseShape <- shape
self$baseRate <- rate
h = replicate(length(theta),uuid::UUIDgenerate())
self$theta <- hashmap::hashmap(h, theta)
self$s <- h[s]
......@@ -366,7 +370,7 @@ DirichletProcessNode <- R6::R6Class(
getData = function()
self$theta$find(self$s),
getDensity = function(i)
sum(self$base(self$theta[self$s[i]],...,log = T))
sum(self$base(self$theta[self$s[i]],shape=self$baseShape, rate=self$baseRate ,log = T))
)
)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment