Dear friends, I work with Matlab and now a bit in trouble with getting used to R. Could you give me some help with the following questions: 1. how to generate the random matrix mxn with constant mean and variance, say N(0,1)? 2. how to create a code (function), say “myfunction”, and make it available for use every time I run R? 3. how to make a package, say “e1071”, available for use without loading it every time when I start R? Thank you. Regards, Max --------------------------------- ur needs [[alternate HTML version deleted]]
Regarding 1 and 2: myfunction <- function(m=2, n=3) array(rnorm(m*n), dim=c(m, n)) myfunction() I'll let someone else answer 3. Spencer Graves Shutnik wrote:> Dear friends, > I work with Matlab and now a bit in trouble with getting used to R. Could you give me some help with the following questions: > > 1. how to generate the random matrix mxn with constant mean and variance, say N(0,1)? > > 2. how to create a code (function), say ?myfunction?, and make it available for use every time I run R? > > 3. how to make a package, say ?e1071?, available for use without loading it every time when I start R? > > Thank you. > > Regards, > > Max > > > > > --------------------------------- > > ur needs > > [[alternate HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Dear friends, I work with Matlab and now a bit in trouble with getting used to R. Could you give me some help with the following questions: 1. how to generate the random matrix mxn with constant mean and variance, say N(0,1)? 2. how to create a code (function), say "myfunction", and make it available for use every time I run R? 3. how to make a package, say "e1071", available for use without loading it every time when I start R? Thank you. Regards, Max ad 3) ?Startup Cheers, Bernhard --------------------------------- ur needs [[alternate HTML version deleted]] ______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help ---------------------------------------------------------------------- If you have received this e-mail in error or wish to read our e-mail disclaimer statement and monitoring policy, please refer to http://www.drkw.com/disc/email/ or contact the sender. ----------------------------------------------------------------------
Hi On 12 Mar 2003 at 15:45, Shutnik wrote:> Dear friends, > I work with Matlab and now a bit in trouble with getting used to R. > Could you give me some help with the following questions: > > 1. how to generate the random matrix mxn with constant mean and > variance, say N(0,1)? > > 2. how to create a code (function), say ?myfunction?, and make it > available for use every time I run R? > > 3. how to make a package, say ?e1071?, available for use without > loading it every time when I start R? >On Windows I use this .Rprofile file in working directory to load three libraries, one data set and change graphic background to white. Its just a plain text file. library(fun) library(modreg) library(ts) data(stand) par(bg="white")> Thank you. > > Regards, > > Max >Cheers Petr Pikal petr.pikal at precheza.cz p.pik at volny.cz
Try (run..): rnorm(1, 0, 1) # (or in this case rnorm(1) - check ?rnorm) aaa <- function(x) x + 1 aaa(1) ?.First Regards, Jussi -----Original Message----- From: Petr Pikal [mailto:petr.pikal at precheza.cz] Sent: Thursday, March 13, 2003 9:45 AM To: Shutnik Cc: r-help at stat.math.ethz.ch Subject: Re: [R] R help Hi On 12 Mar 2003 at 15:45, Shutnik wrote:> Dear friends, > I work with Matlab and now a bit in trouble with getting used to R. > Could you give me some help with the following questions: > > 1. how to generate the random matrix mxn with constant mean and > variance, say N(0,1)? > > 2. how to create a code (function), say ?myfunction?, and make it > available for use every time I run R? > > 3. how to make a package, say ?e1071?, available for use without > loading it every time when I start R? >On Windows I use this .Rprofile file in working directory to load three libraries, one data set and change graphic background to white. Its just a plain text file. library(fun) library(modreg) library(ts) data(stand) par(bg="white")> Thank you. > > Regards, > > Max >Cheers Petr Pikal petr.pikal at precheza.cz p.pik at volny.cz ______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Dear colleagues, Where I can find datasets for exploring the ?detection of change-point in regression relationship? problem? I would appreciate any information about sources of such datasets inside or outside R. Thank you, Max --- This message contains no viruses. Guaranteed by Kaspersky Anti-Virus. www.antivirus.lv
Dear friends, How can I generate (simulate) a large, say 1000x1000, positive definite var-covar matrix? Regards, Max --------------------------------- [[alternate HTML version deleted]]
Here is a solution, but it may take several seconds to run. x <- matrix(rnorm(1050*1000),1050,1000) mat <- t(x)%*%x This is the idea behind Wishart random matrices. In theory, that matrix should be positive definite. This can be verified with eigen(mat,only.values=T) Also read ?ninvwish in package "norm". But I am not sure if it was designed for large matrices. HTH, Jerome On April 10, 2003 11:11 am, Shutnik wrote:> Dear friends, > How can I generate (simulate) a large, say 1000x1000, positive definite > var-covar matrix? > > Regards, > > Max > > > > > --------------------------------- > > > [[alternate HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help