Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: is something wrong with fvvarlist "i(3 4).role"?


From   jpitblado@stata.com (Jeff Pitblado, StataCorp LP)
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: is something wrong with fvvarlist "i(3 4).role"?
Date   Tue, 13 Jul 2010 10:09:49 -0500

Laszlo Sandor <sandorl@gmail.com> is using the new factor variables notation,
specifically the 'i.' operator with a numlist:

> I think I have a straightforward question in the subject line.
> 
> I use the up-to-date Stata on a mac. The factor variable handling does
> not work as promised in the manual (cf. -h fvvarlist-). See the most
> striking, simple example below. Or am I missing the obvious?
> 
> Laszlo
> 
> 
> 
> . sum i(3 4).role
> 
>     Variable |       Obs        Mean    Std. Dev.       Min        Max
> -------------+--------------------------------------------------------
>       4.role |       747    .2503347     .433496          0          1
> 
> . sum i(3/4).role
> 
>     Variable |       Obs        Mean    Std. Dev.       Min        Max
> -------------+--------------------------------------------------------
>       4.role |       747    .2503347     .433496          0          1

Michael Mitchell <Michael.Normal.Mitchell@gmail.com> replied explaining that
level 3 of the 'role' variable is being treated as a reference level.

By default, Stata suppresses the reference level from the output.  Here are a
couple ways that Laszlo can change this behavior.

1.  Use the -baselevels- option to get -summarize- to report the reference
    level.

	. sum i(3 4).role, baselevels

    Since the reference level pseudo variable '3b.role' will only take on the
    values 0 or missing, the only useful information for -summarize- to report
    is the number of non-missing values in the 'role' variable.

2.  Use the 'b.' operator to turn off the reference level logic:

	. sum i(3 4)bn.role

    This will summarize the indicators for both levels of 'role'.

--Jeff
jpitblado@stata.com
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index