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

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

• 5. ledna 2012 16:31

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.

Oopsnut

### Všechny reakce

• 6. ledna 2012 9:16
Vlastník

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.

John