I am still trying to get used to R, and apparently haven't found the right place in the documentation to see how to do what I want in R. If I were to do this in C++, there'd be no problem: I'd write it all myself, but I want to learn R well enough it can save me a lot of coding time. Here is the first task I set for myself. I have a datasource (a vector of values). I want to write a function that produces a frequency distribution of that data and compares it to each of a suite of standard distributions to see which provides the best fit. Along the way, it will produce plots of the empirical distribution and each of the theoretical distributions. It should finish off by providing the moments and confidence intervals for the best fit distribution (odds are that my sample sizes will not be large enough to produce, say, the upper 99.9% confidence limit, so I'd want to compute it from the distribution that best fits the data that is available). I did find a number of functions that estimate the best fit of a given theoretical distribution to a given dataset, but they presuppose that you alreay know what the most appropriate distribution is, and so far I haven't found how to get them to tell me just how good or poor the fit estimated is. Is there an R function that does what I want? If not, what functions, in what packages, should I examine in order to create such a function myself? Thanks Ted