[R] T-Distribution

Liaw, Andy andy_liaw at merck.com
Wed Oct 2 19:50:46 CEST 2002


> From: bojaniss [mailto:bojaniss at poczta.onet.pl]
> 
> Hello Hicham,
> 
> Wednesday, October 2, 2002, 11:28:03 AM, you wrote:
> 
> HZ> Dear sir,
> HZ> I would ask if there are in R some code to generate a 
> random sample 
> HZ> from a mvariate student distribution like that one wich 
> generate the 
> HZ> multivariate normal one i mean( rmvnorm(n, mu, sigma)
> 
> Try rt() function, type ?rt for help.

That's _univariate_ t.  Use the mvtnorm package for multivariate t
distribution.
 
> HZ> Second question : if R can plot density 3Dcurve I don't mean de 
> HZ> histogram but de hole density function(normal for example).
> 
> I think sm.density function in sm package (available on CRAN) will
> do what you want.

That gives the kernel density estimate, given data.  It's not clear what
Hicham wants.  If he wants the _true_ density of a multivariate t, he needs
to contruct a grid (e.g., with expand.grid) and evaluate the multivariate t
density on that grid, then use persp to draw the surface.

Andy
 
> hope this helps
> 
> 
> Michal
> 
> 
> ~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~`~,~
> 
> Michal Bojanowski - mbojanowski at samba.iss.uw.edu.pl
> Polish General Social Survey
> Institute for Social Studies
> University of Warsaw
> http://www.iss.uw.edu.pl/
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
> -.-.-.-.-.-.-.-.-
> r-help mailing list -- Read 
> http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: 
> r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
> _._._._._._._._._
> 


------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message.  If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it.

==============================================================================

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list