[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: RE: RE: Re: RE: RE: Continous to categorical variable
Jason's idea is easier than he implies. You
egen std_mpg = std(mpg)
and then use any rounding you like, e.g.
gen class_mpg = round(std_mpg)
gen class_mpg = floor(std_mpg)
gen class_mpg = ceil(std_mpg)
Recoding to integers 1 up seems superfluous
as the integer codes have a meaning already.
In the case of income, working with log(income)
or quantiles would seem more likely to be
> I would use standard deviations to create the categorical
> variable. Say you wanted six categories -- "1" is greater
> than negative 2 stdev from the the mean, "2" is any
> observation between negative 1 and negative 2 stdev from the
> mean, 3 is between 0 and negative 1 stdevs, 4 is between 0
> and positive 1 stdevs, and so on.
> The only thing "by hand" is calculating the descriptive
> statistics, and recoding the variable six times.
> > I do not want the variable to "become more like a normal
> > What I would like is the categories created to be such that
> the tails
> > contain less individuals, with an increase in the numbers as we get
> > closer to the middle category.
> >> I have a continous variable (i.e. income) and I would like to
> >> transform it into a categorical one (e.g 5 categories/levels or
> >> I would like to ask if there is any way that I can ask stata to
> >> this variable deciding the appropriate cut-off points automatically
> >> that the categories follow aproximately a normal
> distrubution or they
> >> are of equal size.
> > For the latter have a look at -help egen- and look at the cut
> > For the former: how would you expect a variable to become
> more like a
> > normal distribution by making it coarser?
* For searches and help try: