Expand Multilevel Logistic Regression Model to include Individual Covariates

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.