[R] help for MLE

Liaw, Andy andy_liaw at merck.com
Sun Feb 22 20:23:59 CET 2004


A likelihood function is the pdf or pmf as a function of parameters given
the data.  The function you wrote is purely a function of the data, not
parameters.  You need to write the function as a likelihood before you can
get the MLE.

Andy

> From: Edward Sun
> 
> Dear Sir/Madam,
> 
> I am using R version 1.8.1. I am doing following tast:
> 
> First generate 100 Gaussion(3,1) numbers, then write the 
> likelihood function 
> to estimate the parameters of Gaussian distribution by direct 
> maximizing the 
> likelihood function.
> 
> My likelihood function is:
> >fn<-function(x) 
> >(-50*log((sd(x))^2))-50*log(sqrt(2*pi))-(1/2*((mean(x))^2))*(
> sum((x-(mean(x))^2))
> 
> After I input above function, the '' >'' turned to be '' + 
> ''. and it did 
> not work.
> 
> I am looking for the help to solve this tast by writting a likelihood 
> function.
> 
> Thanks a lot.
> 
> Best regards.
> edward sun


------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments,...{{dropped}}




More information about the R-help mailing list