Skip to main content
2 of 2
corrected typo in cov
NeAr
  • 31
  • 3

Getting samples out of a given distribution

I get an error in mathematica when i try to get 10 samples of a MultinormalDistribution with:

sample = 10;
cov = {{0.0000606844, -0.000132364, -0.000149518}, {-0.000132364, 0.00103449,
   0.000833935}, {-0.000149518, 0.000833935, 0.00071455}};
mu= {0.00355655, -0.0517223, -0.026937};
dist = MultinormalDistribution[mu, cov]

Now by applying RandomVariate with a TruncatedDistribution between -1, 1 i want to generate 10 samples:

RandomVariate[
  TruncatedDistribution[
   ConstantArray[{-1, 1}, Length@mu], dist],
   sample] // Transpose

Instead i get the error Message

"The first argument of \
TruncatedDistribution[{{-1,1},{-1,1},{-1,1}},MultinormalDistribution[{\
0.00355655,-0.0517223,-0.026937},{{0.0000606844,-0.000132364,-0.\
000149518},<<1>>,{<<1>>}}]] is expected to be a valid truncation \
specification for the distribution \
MultinormalDistribution[{0.00355655,-0.0517223,-0.026937},<<1>>]."

Anyone knows what im doing wrong?

NeAr
  • 31
  • 3