[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: how to get a scalar value of the ... mode
At 15:29 16/08/02 +0300, Tarmo Räty wrote:
One fundamental problem here is that the mode is not necessarily unique, as
many discrete values of a variable can have an equal frequency, and that
frequency may be the highest frequency. You would have to specify which
mode to use in such cases.
Recently Roger adviced us on how to get a scalar value of the column sum
Works OK, for the most of the statistics, but I need the mode. After
short look on manuals, no funtion returns r(mode). Currently I'm using
egen and picking an observation from the created variable, but there
must be an easy way.
If, in Web-aware Stata, you type
then you will find (among other things) that Nick Cox has written a program
-modes-, which outputs the whole set of modes to the stata log, and that
Nick Cox and Fred Wolfe have written a program -tomode-, which can generate
a new variable containing a mode of an existing variable. There are options
for choosing which mode out of several.
I hope this helps.
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605
Opinions expressed are those of the author, not the institution.
* For searches and help try: