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

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

 From Doug Hemken To statalist@hsphsun2.harvard.edu Subject Re: st: matrix colnames, Kronecker direct products, and factor variables Date Wed, 04 Dec 2013 20:26:56 -0600

```As far as I'm concerned, "equation names" and names/sub-names are just two slots for labels, and with a Kronecker product I'd like to be able to keep track of both sources. I'm mostly surprised that this doesn't work like the documentation suggests. I can think of at least two work-arounds, although neither is as simple. But I'd like to understand why this doesn't just work: it is certainly possible to put factor-like text in equation names directly.

On 12/04/13, Steve Samuels  wrote:
> 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.
>
> Steve
>
>
>
> 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
>
>
> Steve
>
>
> 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.
>
> dehemken@wisc.edu
> 262-4327
>
> To make a consulting appointment send me an email, or use the on-line scheduler:
> https://calendar.wisc.edu/scheduling-assistant/public/profiles/PlRxCykH.html
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
>
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/

--
Doug Hemken
4226I Social Science Bldg.

dehemken@wisc.edu
262-4327

To make a consulting appointment send me an email, or use the on-line scheduler:
https://calendar.wisc.edu/scheduling-assistant/public/profiles/PlRxCykH.html
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```