Dear Patricia,
At 10:49 AM 6/12/2002 -0400, Patricia Farra wrote:
Thanks Sven. This adds one more technique to my learning. Now, my understing
is that cut(x,br) is based upon assumption of normal distribution. Is there
any way make use another distribution? I'm afraid I'm wrong.
From the help file for cut:
cut(x, ...)
cut.default(x, breaks, labels=<<see below>>, include.lowest=F,
factor.result=F, left.include=F)
REQUIRED ARGUMENTS:
x
data vector. Missing values ( NAs) are allowed.
breaks
either a vector of breakpoints, or the number of equal-width intervals
into which the data in x should be cut. If a vector of breakpoints is
given,
the category will have length(breaks)-1 groups, corresponding to data
in the
intervals between successive values in breaks ( breaks must be sorted).
So, for example, using your data, cut(var1, 7) dissects the data into seven
equal-width bins (of width 0.5246), extending slightly to the left and
right of the data, as you may easily verify (see below). What does this
have to do with the normal distribution?
> cut1
[1] 2 2 1 1 2 3 1 2 1 2 3 2 2 1 3 3 3 2 3 2 3 2 1 2 2 2 2 2 2 1
[31] 2 3 2 3 2 2 3 2 1 2 2 1 1 2 2 2 2 1 2 2 6 5 6 3 5 3 4 2 5 2
[61] 2 4 4 4 3 5 3 3 4 3 4 4 4 4 5 5 5 5 4 3 3 3 3 4 3 4 5 4 3 3
[91] 3 4 3 2 3 3 3 4 2 3 4 3 6 4 5 7 2 6 5 6 5 5 5 3 3 5 5 7 7 4
[121] 6 3 7 4 5 6 4 4 5 6 6 7 5 4 4 7 4 5 4 6 5 6 3 5 5 5 4 5 4 4
attr(, "levels"):
[1] "4.26400000+ thru 4.78857143" "4.78857143+ thru 5.31314286"
[3] "5.31314286+ thru 5.83771429" "5.83771429+ thru 6.36228571"
[5] "6.36228571+ thru 6.88685714" "6.88685714+ thru 7.41142857"
[7] "7.41142857+ thru 7.93600000"
attr(, "class"):
[1] "category"
>
Regards,
John
-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox@mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
-----------------------------------------------------
|