« Return to Thread: MLE for noncentral t distribution

Re: MLE for noncentral t distribution

by kate-26 :: Rate this Message:

Reply to Author | View in Thread

Thanks for your quick reply.

I try the command as follows,

library(stats4) ## loading package stats4
ll <- function(change, ncp, df) {-sum(dt(x, ncp=ncp, df=df,
log=TRUE))}#-log-likelihood function
est<-mle(minuslog=ll, start=list(ncp=-0.3,df=2))

But the warnings appears as follows,

invalid class "mle" object: invalid object for slot "fullcoef" in class
"mle": got class "list", should be or extend class "numeric"

When I typed warnings(), I get

In dt(x, ncp = ncp, df = df, log = TRUE) :
  full precision was not achieved in 'pnt'

Does anyone know how to solve it?

Thanks,

Kate


----- Original Message -----
From: "Duncan Murdoch" <murdoch@...>
To: "kate" <yhsu6@...>
Cc: <r-help@...>
Sent: Thursday, May 08, 2008 9:46 AM
Subject: Re: [R] MLE for noncentral t distribution


> On 5/8/2008 10:34 AM, kate wrote:
>> I have a data with 236 observations. After plotting the histogram, I
>> found that it looks like non-central t distribution. I would like to get
>> MLE for mu and df. I found an example to find MLE for gamma distribution
>> from "fitting distributions with R":
>>
>> library(stats4) ## loading package stats4
>> 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)} ## -log-likelihood function
>> est<-mle(minuslog=ll, start=list(lambda=2,alfa=1))
>>
>> Is anyone how how to write down -log-likelihood function for noncentral t
>> distribution?
>
>
> dt() has a non-centrality parameter and a log parameter, so it would
> simply be
>
> ll <- function(x, ncp, df) sum(dt(x, ncp=ncp, df=df, log=TRUE))
>
> Make sure you convert mu into the ncp properly; the man page says how ncp
> is interpreted.
>
> Duncan Murdoch

______________________________________________
R-help@... 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.

 « Return to Thread: MLE for noncentral t distribution