I am just trying to teach myself how to use the mle function in R because it is 
much better than what is provided in MATLAB. I am following tutorial material 
from the internet, however, it gives the following errors, does anybody know 
what is happening to cause such errors, or does anybody know any better 
tutorial material on this particular subject.
  
> x.gam<-rgamma(200,rate=0.5,shape=3.5)
> x<-x.gam
> library(stats4)
> ll<-function(lambda,alfa){n<-200;x<-x.gam 
> -n*alfa*log(lambda)+n*log(gamma(alfa))-9alfa-1)*sum(log(x))+lambda*sum(x)}
Error: syntax error, unexpected SYMBOL, expecting '\n' or ';' or '}' in 
"ll<-function(lambda,alfa){n<-200;x<-x.gam 
-n*alfa*log(lambda)+n*log(gamma(alfa))-9alfa"
> ll<-function(lambda,alfa){n<-200;x<-x.gam 
> -n*alfa*log(lambda)+n*log(gamma(alfa))-(alfa-1)*sum(log(x))+lambda*sum(x)}
> est<-mle(minuslog=ll,start=list(lambda=2,alfa=1))
Error in optim(start, f, method = method, hessian = TRUE, ...) : 
        objective function in optim evaluates to length 200 not 1

   
   


audaces fortuna iuvat
       
---------------------------------

        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch 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