Library: | glm |
See also: | glmmultlo |
Quantlet: | glmmultshape | |
Description: | reshapes data from panel format to matrix format and vice versa. The matrix format is needed for glmmultlo. |
Usage: | xnew = glmmultshape(x,m,format) | |
Input: | ||
x | n x r matrix, the predictor variables. x can be either in matrix format, then r=m*q, i.e. x consists of q nxm matrices. If x is in panel format, n=m*k. | |
m | number of alternatives. | |
format | either "panel" or "matrix", the format that the output should have. | |
Output: | ||
xnew | reshaped x matrix. |
library("glm") x=(1~2)|(3~4)|(5~6)|(1~2)|(3~4)|(5~6) x x=glmmultshape(x,3,"matrix") x x=glmmultshape(x,3,"panel") x
Contents of x [1,] 1 2 [2,] 3 4 [3,] 5 6 [4,] 1 2 [5,] 3 4 [6,] 5 6 Contents of x [1,] 1 3 5 2 4 6 [2,] 1 3 5 2 4 6 Contents of x [1,] 1 2 [2,] 3 4 [3,] 5 6 [4,] 1 2 [5,] 3 4 [6,] 5 6