Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

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.

Link:
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.

Example:
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
Result:
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

Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Author: Marlene Mueller, 980121
(C) MD*TECH Method and Data Technologies, 28.6.1999