 # Generalize LocScaleReparam to matrix transformation

Hello,

I am very new to numpyro, and I was reading the tutorials to solve my specific problem.

In particular, in the eight-school example, the tutorial mentioned the `LocScaleReparam` to generate `N(mu, sigma)` from `N(0, 1) * sigma + mu`.

I was wondering how to construct such transformation when it is for a multivariate normal distribution. Suppose the parameter of interest is a 2-dim `mu_vector` with a multivariate normal prior.

There is a linear relationship between the likelihood function and `mu_vector` such that

X ~ MVN(T*mu_vector, Sigma)

where `T` is a known matrix of size `qx2`, q>2.

Do I need to apply `numpyro.handlers.reparam` to reconstruct the random variable?

``````  with numpyro.handlers.reparam(config={'theta': TransformReparam()}):
theta = numpyro.sample(
'theta',
dist.TransformedDistribution(dist.Normal(0., 1.),
dist.transforms.AffineTransform(mu, tau))
)
numpyro.sample('obs', dist.Normal(theta, sigma), obs=y)``````

I think you can use the following LowerCholeskyAffine for this one.

1 Like