[R] Distribution fitting with binned data

Bradley W. Settlemyer settlemyerbw at ornl.gov
Fri Dec 4 20:04:19 CET 2009


Hello

   I need to fit a distribution to a histogram data set.  I have read 
Ricci's guide to distribution fitting, and am ready to begin 
experimenting with the techniques it mentions, but I am uncertain how to 
get my data in the format he uses.

   My problem is that my data is binned.  So for example my data is in 
the following format

#lb  ub  count
   0   1  4
   1   2  7
   2   3  2

Indicating that I have 4 observations between 0 and 1, 7 obs between 1 
and 2, and 2 obs between 2 and 3.  I assume it should be simple to 
somehow transform the dataset to a vector such as:

1
1
1
1
2
2
2
2
2
2
3
3

But I don't know how to do that in R.  I have a decent amount of 
datasets I will want to perform this distribution fitting analysis, so 
if there is a better way, I'm game to learn about it.  So any help is 
welcome.

Cheers,
Brad




More information about the R-help mailing list