2

I need to generate random samples from a Wishart Distribution in Python. Is there a simple way to do that?

Peter O.
  • 32,158
  • 14
  • 82
  • 96
Rumu
  • 403
  • 1
  • 3
  • 10

1 Answers1

2

scipy has a package for wishart:

import numpy as np
from scipy.stats import wishart

x = np.linspace(1e-5, 8, 100) # make an array
for y in x:
    z = wishart.rvs(1, scale=y)
    print(z)

output:

4.59465858669e-06
0.00403122342709
0.0268879506122
0.0100029090879
0.129477863995
0.372787021348
....

wishart.rvs is the wishart function for random variate sampling.

d_kennetz
  • 5,219
  • 5
  • 21
  • 44