[R] Problems creating a random sample

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jan 12 12:57:48 CET 2000


> Date: Wed, 12 Jan 2000 13:05:21 +0100 (CET)
> From: Adriane Leal <loparic at student.fsa.ucl.ac.be>
> To: r-help at stat.math.ethz.ch
> Subject: [R] Problems creating a random sample 
> 
> Hi!
> 
> I'm supposed to create a random sample bivariate normal variates of size
> equal to 250 with  mean vector (-1,1) and cov matrix (1,0.95,0.95,1)
> 
> In S language I would write:
> 
> > mean<-c(-1,1)
> > cov<-c(1,0.95,0.95,1)
> > covmat<-matrix(cov,nrow=2,ncol=2)
> > mvnorm<-rmvnorm(250,mean,covmat)
> ... and it should work
> 
> I've tried this in R, but it does not recognize "rmvnorm".
> 
> (Error: couldn't find function "rmvnorm")

rmvnorm is an S-PLUS function, version 4.0 and later. It is not part of
S.  It is based on mvrnorm in package MASS (in the VR bundle), so try
that. Your example works for me.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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