Bookmark and Share

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


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

Re: st: generate multi-level dummy


From   Neil Shephard <[email protected]>
To   [email protected]
Subject   Re: st: generate multi-level dummy
Date   Fri, 22 Oct 2010 15:04:20 +0000

On Fri, Oct 22, 2010 at 2:50 PM, Delahanty, Ryan
<[email protected]> wrote:
> Hello,
>
> We have a very high dimensional dataset. There are several categorical variables for which we need to get unique ORs for each combination. For example:
>
> Var1=1,2,3...n
> Var2=1,2,3...m
>
> We need to generate all n x m  categories for logistic regression. So our logistic regression can take the form:
>
> Logistic y 11 12 13 ... 1m...21 22 23...2m...nm
>
> This way we can get ORs for all levels from 11 to nm.
>
> What is the easiest way to generate a new dummy variable that has all of these combinations and is still unique?

You don't state which version of Stata you are using (see FAQ), but
providing you're using Stata 11 this is relatively straight-forward
using the syntax for factor variables (see -man fvvarlist- for full
details)...

logistic y i.m#i.n

Of course there are various caveats about primary effect and
interactions and the number of explanatory variables in relation to
the number of observations but that above (should) achieve what you
want to do.

Neil

-- 
"Our civilization would be pitifully immature without the intellectual
revolution led by Darwin" - Motoo Kimura, The Neutral Theory of
Molecular Evolution

Email - [email protected]
Website - http://kimura-no-ip.org/
Photos - http://www.flickr.com/photos/slackline/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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