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

Quantlet: 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:
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



Author: M. Mueller, 20010228
(C) MD*TECH Method and Data Technologies, 05.02.2006