1
$\begingroup$

I have some data. Does anybody know a function which can fit the parameters of a t-distribution of this data when I know the numbers of degrees of freedom?

Thanks!

$\endgroup$
3
  • 1
    $\begingroup$ You might also want to mention which parameters you're interested in. Are we talking about some sort of shifted t-distribution? Do you want to estimate a non-centrality parameter? What are you trying to estimate? $\endgroup$
    – Dason
    Sep 10, 2012 at 14:29
  • 1
    $\begingroup$ See the fitdistr function in the MASS package -- especially the second example in ?fitdistr ... $\endgroup$
    – Ben Bolker
    Sep 10, 2012 at 14:31
  • $\begingroup$ I want to estimate mean = mu and variance = sigma like the function fit.st of the QRM-packages does it, but this function also estimate the number of degrees of freedom but I just know this number. $\endgroup$
    – Kim Müller
    Sep 10, 2012 at 14:44

1 Answer 1

2
$\begingroup$

Expanding @Ben Bolker's comment:

You may use the fitdistr function in R MASS package.

See the second example in ?fitdistr function help. Also in this pdf, page 50.

library(MASS)

#generate a random sample with t distribution, where the degrees of freedom = 9.
set.seed(123)
x2 <- rt(250, df = 9)

#find the parameters for the t distribution
fitdistr(x2, "t", df = 9)

the output is:

       m             s     
  -0.01069496    1.04410551 
 ( 0.07222623) ( 0.05434369)

where the second line represents the parameter estimates, and the numbers inside brackets are their standard deviations.

fitdistr uses the Maximum Likelihood Estimation (MLE) method to adjust the parameters of a given distribution.
For a theoretical insight about MLE, you might find @Glen_b's answer helpful.

Reference.

Venables, W. N., & Ripley, B. D. (2002). Modern Applied Statistics with S (4a ed., p. 495).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.