Previous: The Intuitive Layout Up: Easy Ways to Manage Next: The Memory-Efficient Layout

The Computationally-Efficient Layout

Choosing array 53#53 and vector 12#12 is probably the the most computationally-efficient configuration: model.matrix(..., shape = "array") produces an 122#122 array where 123#123 is the total number of equations and 124#124 is the total number of parameters across all the equations. Since some parameter values may be constrained across equations, 125#125 . If a variable is not in a certain equation, it is observed as a vector of 0s. With this option, each 70#70 69#69 matrix becomes:

126#126    

By stacking each of these 69#69 matrices along the first dimension, we get 53#53 as an array with dimensions 122#122 .

Correspondingly, 12#12 is a vector with elements

115#115    

To multiply the 53#53 array with dimensions 127#127 and the 119#119 12#12 vector, we vectorize over equations as follows:
eta <- apply(X, 3, '%*%', beta) 
The linear predictor eta is therefore a 128#128 matrix.



Gary King 2011-11-29