Prev Up Next
Go backward to 3.3 The Main Window Buttons
Go up to 3 glmlab Reference
Go forward to 3.5 Returned Variables

3.4 Extra Commands

3.4.1 fac

The fac command indicates that the variable is a factor. Factors are also called qualitative variables or categorical variables. To fit a model using the factor Gender, use fac(Gender).

3.4.2 makefac

makefac is used to generate a factor that has some regularity. (It is similar to the GLIM command %gl.) The general syntax of the makefac command is

makefac(length, number_of_levels, size_of_the_blocks)

For example, if the variable Gender in a data set was recorded as M, M, M, M, F, F, F, F then makefac could be used to generate the numeric equivalent. The vector would need to be of length 8; there are two levels (M and F), and they are repeated in block of size 4. The variable can be generated using makefac(8,2,4). If Gender was recorded as M, M, F, F, M, M, F, F, then the variable would be generated using makefac(8,2,2).

3.4.3 The @ Character

The @ character is used to specify interactions, and is usually obtained by holding down the SHIFT key while pressing 2. For example, to interact two variables called Height and Gender (which is a factor), use Height@fac(Gender).


Peter Dunn

Prev Up Next