Drawing random samples from GaussianRandomWalk


I am trying to draw random samples from GaussianRandomWalk by doing something like:

with pm.Model() as model:
a = GaussianRandomWalk(‘a’, sd=0.024, shape=25000)
y = a.random()

Which throws the TypeError: ‘NoneType’ object is not callable

I can do this for continuous functions so I guess I am missing something but am unsure what.

Thanks for your insight,

Hi gpoon

The standard approach is to use the .dist method of a distribution outside of a model context.

pm.GaussianRandomWalk.dist(0.024, shape=8).random(size=100)

This will produce 100 random walks each of length 8. Hope this helps.

I tried it, outside of a model context, but now I get:

AttributeError: ‘GaussianRandomWalk’ object has no attribute ‘random’

I appreciate any suggestions. Thanks again!

Try upgrading to the master branch of PyMC3 from GitHub.

I upgraded to v3.8 and it goes. Thanks again!