[R] Least Squares Method

aledanda danda.galli at gmail.com
Thu Jun 4 17:17:21 CEST 2009


Dear Helpers,

I need to fit a gamma function on a distribution. I want to use the Method
of the Least Squares for minimizing the sum of squared residuals (SSE). I
don't know how to do this. I guess I need to calculate the best fit
parameter values and then somehow comparing my empirical distribution with
the theorical one (in this case gamma). This is what I've done so far:

"rate" is the name of my distribution (12000 data point)

mean<- mean(rate)   # mean of the empirical distribution
var <-var(rate)    # variance of the empirical distribution
l.est <- mean/var    # lambda estimate (scale param.)
a.est <- (mean^2)/var  # alfa estimate (shape param.)

should I create a random gamma distribution and then comparing it with my
data? But how?
And then Is there a way to visualize in a graph the fitting with gamma?

Thanks a lot for your help!!

Alessandra



-- 
View this message in context: http://www.nabble.com/Least-Squares-Method-tp23872037p23872037.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list