Rajarshi Guha <[EMAIL PROTECTED]> wrote:
          is there a way to plot distribution curves (say normal or chi sq etc)
        from within R?
        
        For example I looked up the *chisq family of functions but I'm not sure
        as to how I would use them to generate a plot of the chi sq distribution
        (for arbitrary d.o.f).
        
Perhaps the most obvious way:
    x <- seq(0, 30, length=101)
    plot(x, dchisq(x, df=8))

Another way:
    curve(dchisq(x,df=8), from=0, to=30)

As someone has recently noted, code that depends on the textual
form of something is often subtly wrong, which is why I think that
"curve" and similar functions are best avoided.  A third way that
is better than "curve" is

    plot(function(x) dchisq(x,df=8), from=0, to=30)

in which the name of the argument x no longer matters.

This can of course be used with any function, not just a c* function.

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to