Diff of /src/include/graph/ConstantNode.h [1991be] .. [c69947]  Maximize  Restore

Switch to side-by-side view

--- a/src/include/graph/ConstantNode.h
+++ b/src/include/graph/ConstantNode.h
@@ -13,23 +13,29 @@
  * defined when they are constructed and which is shared across all
  * chains.
  *
- * There are two sub-classes of ConstantNode representing explicit
- * constants defined in the model (ConstantParameterNode) and implicit
- * constants with values supplied by the data (ConstantDataNode).
+ * JAGS distinguishes between two classes of ConstantNode. Those
+ * defined explicitly as constants in the BUGS language description of
+ * the model are constructed with the parameter observed=false, and
+ * are not considered random variables. Constant nodes that are
+ * implicitly defined (i.e. they only appear on the left hand side of
+ * any relation and their values are determined by the user-supplied
+ * data) are constructed with the parameter observed=true and are
+ * considered to represent observed randmo variables.
  */
 class ConstantNode : public Node {
+    const bool _observed;
 public:
     /**
      * Constructs a scalar constant node and sets its value. The value
      * is fixed and is shared between all chains.
      */
-    ConstantNode(double value, unsigned int nchain);
+    ConstantNode(double value, unsigned int nchain, bool observed);
     /**
      * Constructs a multi-dimensional constant node 
      */
     ConstantNode(std::vector<unsigned int> const &dim, 
 		 std::vector<double> const &value,
-		 unsigned int nchain);
+		 unsigned int nchain, bool observed);
     /**
      * Indicates whether a ConstantNode is discrete-valued
      */
@@ -56,6 +62,11 @@
      * A constant node is always fixed.
      */
     bool isFixed() const;
+    /**
+     * The RVStatus of a ConstantNode is determined by the parameter
+     * "observed" passed to the constructor.
+     */
+    RVStatus randomVariableStatus() const;
 
 };
 

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks