Fitting t-distribution in R: scaling parameter

How do I fit the parameters of a t-distribution, i.e. the parameters corresponding to the 'mean' and 'standard deviation' of a normal distribution. I assume they are called 'mean' and 'scaling/degrees of freedom' for a t-distribution?

The following code often results in 'optimization failed' errors.

library(MASS)
fitdistr(x, "t")


Do I have to scale x first or convert into probabilities? How best to do that?

Thanks!

-

In the help for fitdistr is this example:

fitdistr(x2, "t", df = 9)


indicating that you just need a value for df. But that assumes standardization.

For more control, they also show

mydt <- function(x, m, s, df) dt((x-m)/s, df)/s
fitdistr(x2, mydt, list(m = 0, s = 1), df = 9, lower = c(-Inf, 0))


where the parameters would be m = mean, s = standard deviation, df = degrees of freedom

-
I guess I am confused about the parameters of a t-distribution. Does it have 2 (mean,df) or 3 (mean, standard deviation, df) parameters? I was wondering if one could fit the parameter 'df'. –  user12719 Dec 12 '12 at 21:10
@user12719 The Student's-t distribution has three parameters: location, scale and degrees of freedom. They are not referred as mean, standard deviation and df because the mean and the variance of this distribution depend on the three parameters. Also, they do not exists in some cases. Peter Flom is fixing the df but this can be considered as an unknown parameter as well. –  user10525 Dec 12 '12 at 21:25
@Procrastinator I was just going from the help files - m and s are shown, which clearly stand for mean and sd, right? Is this an error in the help files for MASS? (If so, who will tell them?????). Of course df can vary too. –  Peter Flom Dec 12 '12 at 21:58
@PeterFlom In the case of the Cauchy distribution it is explicit that m and s are the location and scale. I agree the notation m and s suggests that they represent the mean and standard deviation, respectively. But this may just be a simplification of \mu and \sigma as well. +1 long ago, by the way. –  user10525 Dec 12 '12 at 22:09