Library: | glm |
See also: | glmmultlo |
Macro: | 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
Content of object x [1,] 1.000000 2.000000 [2,] 3.000000 4.000000 [3,] 5.000000 6.000000 [4,] 1.000000 2.000000 [5,] 3.000000 4.000000 [6,] 5.000000 6.000000 Content of object x [1,] 1.000000 3.000000 5.000000 2.000000 4.000000 6.000000 [2,] 1.000000 3.000000 5.000000 2.000000 4.000000 6.000000 Content of object x [1,] 1.000000 2.000000 [2,] 3.000000 4.000000 [3,] 5.000000 6.000000 [4,] 1.000000 2.000000 [5,] 3.000000 4.000000 [6,] 5.000000 6.000000
Library: | glm |
See also: | glmmultlo |