[R] fitdistr for t distribution
pauljohn32 at gmail.com
Sat May 16 20:04:37 CEST 2009
On Fri, May 15, 2009 at 6:22 AM, lagreene <lagreene101 at gmail.com> wrote:
> Thanks Jorge,
> but I still don't understand where they come from. when I use:
> fitdistr(mydata, "t", df = 9) and get values for m and s, and the variance
> of my data should be the df/s?
> I jsut want to be able to confirm how m and s are calculated
I've wondered the same kind of thing and I've learned the answer is
easy! It is not so easy for all R functions, but did you try this
> library (MASS)
the output that follows is the ACTUAL FORMULA that is used to make the
I've not yet mastered the art of getting code for some functions.
function (object, ...)
But I know there is a way to get that code if you know the correct way
to run getS3method(). But I usually just go read the R source code
rather than puzzle over that.
> 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))
> Thanks anyway for the help!
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas
More information about the R-help