# Error while using dims with multiple linear regression model

Howdy! I ran into some problems using coords and dims in my model.
“wavelength” is 131, “compound” is 10, “samples” is 25 in the following code.

``````coords = {"wavelength": spectra.columns,
"compound": conc.columns,
"samples": spectra.index
}

with pm.Model(coords=coords) as linearmodel:
#data
y = spectra.T.values
x = conc.T.values
#prior
sigma = pm.HalfCauchy("sigma", beta=5)
intercept = pm.Normal("intercept", 0, sigma=5, dims="wavelength")
slope = pm.Normal("slope", 0, sigma = 5, dims=("wavelength", "compound"))

#likelihood
likelihood = pm.Normal("y", mu= (slope @ x) + intercept,sigma=sigma, observed=y)
``````

Im getting the following error code
` "ValueError: Incompatible Elemwise input shapes [(131, 25), (1, 131)]"` for the sum of slope @ x and the intercept. If I replace dims=“wavelength” in the intercept for “shape=(131,1)” the code works as intended.
What would be the correct way to make this work using dims? I was under the impression that dims=“wavelength” or dims=("wavelength,) should make a (131,1) vector that would broadcast correctly.

dims in PyMC are just labels for the outputs of sampling, they have no effect. All broadcasting works positionally just like in numpy.

Ok! so there is no way to make the intercept a (131,1) vector by passing dims=“wavelength”.
What would be the recommended way to make a row or column vector with dims? adding an axis afterwards?

Like:

``````intercept = pm.Normal(0,1,dims="wavelength")

likelihood = pmNormal(mu= slope@x + intercept[None,:], sigma=sigma)
``````

This is how I usually do it. You could also use `.reshape`. You could also transpose `slope @ x`, because from the error it seems the problem is that you have wavelengths on different dimensions in each object.