# Can't use GaussianRandomWalk output as sigma for another GaussianRandomWalk

**URL:** <https://discourse.pymc.io/t/cant-use-gaussianrandomwalk-output-as-sigma-for-another-gaussianrandomwalk/16860>\
**Category:** v5\
**Created:** [April 10, 2025, 6:03pm UTC](https://discourse.pymc.io/t/cant-use-gaussianrandomwalk-output-as-sigma-for-another-gaussianrandomwalk/16860 "2025-04-10T18:03:26Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ricardoV94](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/ricardov94/32/5775_2.png) [@ricardoV94](https://discourse.pymc.io/u/ricardoV94)\
**Post date:** [April 11, 2025, 3:13am UTC](https://discourse.pymc.io/t/cant-use-gaussianrandomwalk-output-as-sigma-for-another-gaussianrandomwalk/16860/2 "2025-04-11T03:13:29Z")

</div>

Couple of things. GRW expects T on the right, and more importantly it doesn’t allow sigma to vary over steps.

You can use a CustomDist for your purpose or if the variable is not observed use the expression in the dist directly (defining the latent Normal as a model variable instead of using .dist):

```python
def noise_varying_grw_dist(sigma, size=None):
  return pm.Normal.dist(0, sigma, size=size).cumsum(-1) # or wherever time is

with pm.Model() as m:
  ...
  predictors_noise = pm.CustomDist(
    "predictors_noise",                
    sigma, 
    dist=noise_varying_grw_dist,
    shape=(N, T),
)

```

Disclaimer: untested code

---

_[View the full topic](https://discourse.pymc.io/t/cant-use-gaussianrandomwalk-output-as-sigma-for-another-gaussianrandomwalk/16860)._
