Hi, Actually I am facing a similar problem. I would like to fit both an ordinary (symmetric) and a non-central t distribution to my (one-dimensional) data (quite some values.. > 1 mio.). For the symmetric one, fitdistr or funInfoFun (using fitdistr) from the qAnalyst package should do the job, and for the non-central one.. am I right to use
gamlss(x ~ 1, family=GT()) ? Anyway, I am a little unsure how to handle the degrees of freedom. I have the feeling that it is not smart to not hold them fixed, but how can I actually determine them? If anyone could help me, I'd be really grateful... gamlss has a great documentation, but it's a bit overwhelming. Kind regards Susanne **************************** Susanne Balzer PhD Student Institute of Marine Research N-5073 Bergen, Norway Phone: +47 55 23 69 45 susanne.balzer at imr.no www.imr.no > [R] MLE for noncentral t distribution > Spencer Graves spencer.graves at pdf.com > Fri May 9 16:32:47 CEST 2008 > > * Previous message: [R] MLE for noncentral t distribution > * Next message: [R] MLE for noncentral t distribution > * Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] > > Hi, Martin and Kate: > > KATE: Do you really want the noncentral t? It has mean zero but > strange tails created by a denominator following a noncentral > chi-square. The answer Martin gave is for a scaled but otherwise > standard t, which sounds like what you want, since you said the "sample > mean = 0.23, s = 4.04, etc. A noncentral t has an additional > "noncenrality parameter". > > Hope this helps. > Spencer > > Martin Maechler wrote: > >>>>>> "k" == kate <yhsu6 at uiuc.edu> > >>>>>> on Thu, 8 May 2008 10:45:04 -0500 writes: > >>>>>> > > > > k> In my data, sample mean =-0.3 and the histogram looks like t > distribution; > > k> therefore, I thought non-central t distribution may be a good > fit. Anyway, I > > k> try t distribution to get MLE. I found some warnings as > follows; besides, I > > k> got three parameter estimators: m=0.23, s=4.04, df=1.66. I > want to simulate > > k> the data with sample size 236 and this parameter estimates. Is > the command > > k> rt(236, df=1.66)? Where should I put m and s when I do > simulation? > > > > m + s * rt(n, df= df) > > > > [I still hope this isn't a student homework problem...] > > > > Martin Maechler, ETH Zurich > > > > k> m s df > > k> 0.2340746 4.0447124 1.6614823 > > k> (0.3430796) (0.4158891) (0.2638703) > > k> Warning messages: > > k> 1: In dt(x, df, log) : generates NaNs > > k> 2: In dt(x, df, log) : generates NaNs > > k> 3: In dt(x, df, log) :generates NaNs > > k> 4: In log(s) : generates NaNs > > k> 5: In dt(x, df, log) : generates NaNs > > k> 6: In dt(x, df, log) : generates NaNs > > > > k> Thanks a lot, > > > > k> Kate > > > > k> ----- Original Message ----- > > k> From: "Prof Brian Ripley" <ripley at stats.ox.ac.uk> > > k> To: "kate" <yhsu6 at uiuc.edu> > > k> Cc: <r-help at r-project.org> > > k> Sent: Thursday, May 08, 2008 10:02 AM > > k> Subject: Re: [R] MLE for noncentral t distribution > > > > > > >> 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 ______________________________________________ R-help@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.