Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: matrix colnames, Kronecker direct products, and factor variables

From   Steve Samuels <>
Subject   Re: st: matrix colnames, Kronecker direct products, and factor variables
Date   Wed, 4 Dec 2013 18:54:31 -0500

Sorry, you asked about factor names in matrix A. You are quite right that they do not
behave like equation names. Whether they *should* is another question.


Note that factor variable names are not equation names.  The following version (you seem to have switched A & B) produce column names that are a combination of those from A & B.

matrix colnames B = eqn1:_new eqn1:_old
matrix C =  A # B


On Dec 4, 2013, at 3:02 PM, Doug Hemken wrote:

I don't get what I expect. The documentation I find says the columns of the product matrix, A # B, will have names from matrix B and equation names from matrix A?

But if I have factor variable names for the columns of A, they simply disappear in the product. (I also notice that when I assign column names that appear to be factor variables or interaction terms, Stata alters my labels, usually for the better.)

For example:
matrix A = (1,21 \ 0 ,1)
matrix colnames A = _cons mpg
matrix B = I(2)
matrix colnames B = 0.foreign 1.foreign

matrix C = B' # A
matrix list A
matrix list B
matrix list C

The column labeling on C is not what I expect!
Doug Hemken
4226I Social Science Bldg.

To make a consulting appointment send me an email, or use the on-line scheduler:
*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index