Dear Pari
On 7 October 2014 10:55, pari hesabi <statistics84 at hotmail.com>
wrote:> HelloI am trying to estimate the parameter of a function by the Maximum
Likelihood Estimation method.If the function is the difference between two
integrals: C<-function(n){integrand3<-function(x)
{((2-x)^n)*(exp(ax-2))}cc<- integrate (integrand3,0,2)print(cc)}
> D<-function(n){integrand4<-function(x) {((5-ax)^n)}cc<- integrate
(integrand4,0,2)print(cc)}
> f(n) = C(n) - D(n)
> I need to estimate parameter (a). loglikelihood function is in the form
of sum[F(k) log(f(k))]=lnL. I am wondering how to introduce my logliklihood
function to the loop below. Can anybody help me for correcting the following
loop? if there are some other packages better than this , please let me
know.Thank you,Diba
> n <- c(0,1,2,3,4,5,6,7,8)
> F<-c(0,0,1,3,5,7,8,11,10)
> loglik <- function(a) sum(F*log(C(n)-D(n)))
> re <- maxLik (loglik, start=.5)
> summary(re)
Unfortunately, I cannot reproduce your example, because I get an error
message about an unexpected symbol.
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Best regards,
Arne
--
Arne Henningsen
http://www.arne-henningsen.name