Is Constrain.Equal(double d, Variable<double> v) the same as setting v.Observed = d


  • I'm confused about what Constrain.Equal(double d, Variable<double> v) really does.  The documentation says that this sets the random variable to a constant.  If the random variable had been previously set to a distribution, does this put any constraint on that distribution or does it simply redefine the random variable? 

    I've read 101 & the user manual cover to cover but am pretty new to this so any help is greatly appreciated.

    Thursday, January 05, 2012 4:31 PM

All replies

  • Hi Ed

    Constrain.Equal is more commonly used for two random variables in which case it constrains the the two (previously defined) random variables to be equal.

    Using it with a constant is equivalent to observing v, and there are many examples in the documentation where we observe random variables.

    So, for example, if v is defined by a fixed distribution, there is nothing more to infer. Whereas if v is defined in terms of other random variables (for example it's defined in terms of a Gaussian with a random mean) then we can make inferences about those other random variables by observing v.


    Friday, January 06, 2012 9:16 AM