Search code examples
rdistributionfitdistrplus

Trouble with 'fitdistrplus' package, t-distribution


I am trying to fit t-distributions to my data but am unable to do so. My first try was

fitdistr(myData, "t")

There are 41 warnings, all saying that NaNs are produced. I don't know how, logarithms seem to be involved. So I adjusted my data somewhat so that all data is >0, but I still have the same problem (9 fewer warnings though...). Same problem with sstdFit(), produces NaNs.

So instead I try with fitdist which I've seen on stackoverflow and CrossValidated:

fitdist(myData, "t")

I then get

Error in mledist(data, distname, start, fix.arg, ...) :
'start' must be defined as a named list for this distribution

What does this mean? I tried looking into the documentation but that told me nothing. I just want to possibly fit a t-distribution, this is so frustrating :P

Thanks!


Solution

  • Start is the initial guess for the parameters of your distribution. There are logs involved because it is using maximum likelihood and hence log-likelihoods.

    library(fitdistrplus)
    dat <- rt(100, df=10)
    fit <- fitdist(dat, "t", start=list(df=2))