Hello, i'm using R for the exploration of a time series and i'm stuck in a 
problem with the fitting of the distribution.
What's the difference between "fitdistr" and "mle"?

library(MASS)
fitting <- fitdistr(ret,densfun="normal")
print(c(mean(ret),sd(ret)))
-------------------------------------------------------------
The output of fitdistr is: 
  mean             sd      
  -1.526547e-05    1.692554e-02 
 ( 5.105564e-04) ( 3.610179e-04)
-------------------------------------------------------------

library(stats4)
loglink <- function(media=0, devstd=1){
  -sum(dnorm(ret, mean=media, sd=devstd, log=TRUE))
}
mle(loglink)
-------------------------------------------------------------

The output of mle is:
Call:
mle(minuslogl = loglink)

Coefficients:
        media        devstd 
-1.593559e-05  1.695075e-02 


Thank you for the help.
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to