Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I want to create a histogram for my continuous variable x that has lots of outliers (let's say values greater than 100 and less than -100 are where the outliers are). In order to make the histogram easy to read, I aggregate the values of x greater than 100 and less than -100.

However, I also want to label the values 100 and -100 as >=100 and <=-100 respectively. However, I couldn't figure out how to label only two values of a continuous variable in Stata.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
287 views
Welcome To Ask or Share your Answers For Others

1 Answer

 gen whatever2 = clip(whatever, -100, 100)
 label def whatever2 -100 "{&le}-100" 100 "{&ge}100" 
 label val whatever2 whatever2 
 histogram whatever2 , start(-100) width(10) xla(, valuelabel) 

should get you started. You may need to specify which xlabel()s are shown.

I would just use -- or want to see -- a quantile plot for some transformed scale, such as cube root, sign(y) log(1 + |y|) or asinh(y). Don't hide outliers!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...