Re: [R] MLE for noncentral t distribution

From: kate <yhsu6_at_uiuc.edu>
Date: Thu, 08 May 2008 10:45:04 -0500

In my data, sample mean =-0.3 and the histogram looks like t distribution; therefore, I thought non-central t distribution may be a good fit. Anyway, I try t distribution to get MLE. I found some warnings as follows; besides, I got three parameter estimators: m=0.23, s=4.04, df=1.66. I want to simulate the data with sample size 236 and this parameter estimates. Is the command rt(236, df=1.66)? Where should I put m and s when I do simulation?

       m s df
  0.2340746 4.0447124 1.6614823
 (0.3430796) (0.4158891) (0.2638703)
Warning messages:

1: In dt(x, df, log) : generates NaNs
2: In dt(x, df, log) : generates NaNs
3: In dt(x, df, log) :generates NaNs
4: In log(s) : generates NaNs
5: In dt(x, df, log) : generates NaNs
6: In dt(x, df, log) : generates NaNs

Thanks a lot,

Kate

> On Thu, 8 May 2008, 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.
>
> So you mean 'non-central'? See ?dt.
>
>> 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?
>
> Just use dt. E.g.
>
>> library(MASS)
>> ?fitdistr
>
> shows you a worked example for location, scale and df, but note the
> comments. You could fit a non-central t, but it would be unusual to do
> so.
>
>>
>> Thanks a lot!!
>>
>> Kate
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help_at_r-project.org 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.
>>
>
> --
> Brian D. Ripley, ripley_at_stats.ox.ac.uk
> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel: +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UK Fax: +44 1865 272595



R-help_at_r-project.org 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. Received on Thu 08 May 2008 - 16:56:44 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 09 May 2008 - 07:30:36 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive