Hi, I am following an example of hierarchical model presented by Chris (Kudos to him!) in order to learn probabilisitic programming. When the model is expanded to include individual covariate, I don’t understand the code marked by redlines. I tried to add only one covariate but I couldn’t figure out the correct codes. Is there any way I can read some documents to learn it?

For the `coords`

line, you can check out this tutorial on named dimensions in PyMC.

The math part X_i \beta, is an inner product between the `i`

-th row of a matrix X and a coefficient vector \beta. The line you boxed in code, `beta.dot(X.T)`

, is doing the full matrix-vector product to get all the rows in one shot. There are lots of resources for linear algebra if it’s new to you, I like the Gilbert Strang MIT OpenCourseware lectures.

Hi Jesse, thank you for your reply. It is very helpful for a PyMC beginner. Now, I have better understanding of the dimension and math code. However, I ran into a problem when I modify the matrix (X) from 2-dims to 1-dim. Although I can produce a 1-dim array of X, I found the dimension of coords is incorrect. I read through the dimensions tutorial in PyMC but I can’t figure out the answer. Do you mind shedding some light for me?

coords is a dictionary of dimension keys and label values. Labels should be sequences. In python, a string is a sequence of characters, so you have set `coords['metric'] = ['l', 'a', 'u', 'n', 'c', 'h', '', 'a', 'n', 'g', 'l', 'e']`

, which has a length of 12, as reported. I am not sure what your intended output is.

Also, in the future, please post code in formatted code blocks (using triple backticks ``` ), and not as images.