[R] Maximum likelihood estimation in R

Edward Sun edwardweisun at hotmail.com
Sun Feb 15 21:48:37 CET 2004


Dear Sir,

I am a new user of R and I am doing a tast, which is: find the maximum 
likelihood estimate of the parameter of Gaussian distribution for generated 
100 numbers by using >x=rnorm(100, mean=3, sd=1).

I tried to use following Maximum Likelihood function
>fn<-function(x)
(-50*log((sd(x))^2))-50*log(sqrt(2*pi))-(1/2*((mean(x))^2))*(sum((x-(mean(x))^2)),
but it did not work.

I am looking for the complete syntax to finish my target task.

Thanks for your help.

Best regards.
Edward Sun
Germany




More information about the R-help mailing list