Consider the following example.
That is, I am trying to identify and remove the variable causing the perfect collinearity (in the example above, the dummy variable for the third race category).
But, as we can see in the example, the _rmcoll command just identifies the base category, and thus the st_data command returns a matrix that replace the column of the third race to zeros.
What I want to make is a matrix that does not contain the column of zeros.
How can I do that?
Code:
// load data . webuse nlswork, clear // specify a variable list, where "race" is a factor variable . local X = "age ib3.race" // expand the factor variable "race", and then identify the base category indicator // I do this due to the collinearity issue . _rmcoll `X', expand // check the updated local macro . display "`X'" // check whether the st_data command call a matrix without the base category variable . mata: st_data(., st_local("X"))
But, as we can see in the example, the _rmcoll command just identifies the base category, and thus the st_data command returns a matrix that replace the column of the third race to zeros.
What I want to make is a matrix that does not contain the column of zeros.
How can I do that?
Comment