0
$\begingroup$

I am designing the design matrix for my general linear model (GLM). Besides the dummy constant column, I wish to have 4 regressors (columns) in my design matrix. They are diagnosis, age, gender, and weight.

The diagnosis is definitely the most important. It is trinary, i.e., normal, intermediate, or severe. The age, gender, and weight are just (not important) confounds that I wish to model, just in case they have effects on my observed data.

Originally, I have one column for each of these four factors.

  1. diagnosis: 0 means normal, 1 means intermediate, and 2 means severe;
  2. age: 13 means 13 years old, and etc.;
  3. gender: 0 means male, and 1 means female;
  4. weight: 75 means 75 kg, and etc..

An example:

    /0 26 1 75\ - means a 26 year-old and 75 kg female, no disease
    |2 13 0 60| - means a 13 year-old and 60 kg male, severe stage
    |1 12 1 77| - means a 12 year-old and 77 kg female, intermediate disease
    |   ...   |
    \         /

I then was told that I better split my diagnosis into 3 columns, with each being binary, because this way I am assuming the intermediate stage (2) is equidistant from normal (1) and sever (3), which is not the case.

So now my design matrix becomes

    /1 0 0 26 1 75\ - means a 26 year-old and 75 kg female, no disease
    |0 0 1 13 0 60| - means a 13 year-old and 60 kg male, severe stage
    |0 1 0 12 1 77| - means a 12 year-old and 77 kg female, intermediate disease
    |     ...     |
    \             /

This modification makes sense to me, but it gets me wondering if I should do the same thing to the age and weight (no need to gender, since it is already binary).

If I do the same thing, imagine how many more columns I would have (e.g., if the age ranges 12 to 60, I would have 60-12+1=49 binary columns. Same for the weight. Moreover, weight could be a decimal, say 70.3 kg)!

It therefore seems that I can't do the same thing to age and weight. But As you can see, the diagnosis columns and gender column are binary, but the age and weight columns are not! Will this mixture of binary and multinary columns work?

$\endgroup$
1
+50
$\begingroup$

I assume that you want to do (or start with) GLM, not any other model.

First, the mixture of binary and numerical predictors does work for GLM.

Second, you should split the diagnosis to 2, not 3, columns (normal->(0,0), intermediate->(0,1), severe->(1,1) or (1,0)), otherwise your matrix will be degenerate.

Third, don't split the age column to 100 or so binary columns! If the age A is 0 to 100, you may split the column to, say, 10 binary columns: A, max(0,A-10), max(0,A-20) ... max(0,A-90) in order to take into account the possible non-linearity. Check the number of columns which behaves optimally for the cross-validation.

Fourth, the weight alone, without height, is not very useful for predicting the outcome. You could at least use the ratio $\mathrm{Weight}\over \mathrm{Average\ weight\ for\ the\ gender\ and\ age}$. This ratio could be divided to several intervals as above.

The important factor is how many records you have. A rule of thumb is, the number of predictors should not exceed the number of records divided by 5-10.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.