Originally posted by Nick Cox
View Post
Code:
clear * set obs 10 generate byte y = 3 if _n < 6 replace y = 4 if _n > 5 egen ymode = mode(y) list, clean hsmode y
Code:
. egen ymode = mode(y) Warning: multiple modes encountered. Generating missing values for the mode. Use the maxmode, minmode, or nummode() options to control this behavior. (10 missing values generated) . list, clean y ymode 1. 3 . 2. 3 . 3. 3 . 4. 3 . 5. 3 . 6. 4 . 7. 4 . 8. 4 . 9. 4 . 10. 4 . . hsmode y (n = 10) mode ----------- y 3
Moreover, if your interest is in the existence or extent of bimodality or multimodality, it will be best to look directly at suitably smoothed estimates of the density function.
Leave a comment: