Neuro LeSuperHéros
2006-Jul-14 12:14 UTC
[R] Generating random normal distribution with mean 0 and standard deviation 1
Hello, This must be really simple, but I can't find it on R Site search. I need to generate a random normally distributed series with mean 0 and sd 1. In Matlab, this code is randn(n). The closest I found is runif(20,-1,1) but this forces a maximum and a minimum, and there's no way to specify a standard deviation of 1.>sd(runif(20,-1,1))[1] 0.578164
Sean O'Riordain
2006-Jul-14 12:19 UTC
[R] Generating random normal distribution with mean 0 and standard deviation 1
?rnorm On 14/07/06, Neuro LeSuperH?ros <neuro3000 at hotmail.com> wrote:> Hello, > > This must be really simple, but I can't find it on R Site search. I need to > generate a random normally distributed series with mean 0 and sd 1. In > Matlab, this code is randn(n). > > The closest I found is runif(20,-1,1) but this forces a maximum and a > minimum, and there's no way to specify a standard deviation of 1. > > >sd(runif(20,-1,1)) > [1] 0.578164 > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >
michael watson (IAH-C)
2006-Jul-14 12:19 UTC
[R] Generating random normal distribution with mean 0 and standarddeviation 1
See rnorm() -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Neuro LeSuperH?ros Sent: 14 July 2006 13:15 To: r-help at stat.math.ethz.ch Subject: [R] Generating random normal distribution with mean 0 and standarddeviation 1 Hello, This must be really simple, but I can't find it on R Site search. I need to generate a random normally distributed series with mean 0 and sd 1. In Matlab, this code is randn(n). The closest I found is runif(20,-1,1) but this forces a maximum and a minimum, and there's no way to specify a standard deviation of 1.>sd(runif(20,-1,1))[1] 0.578164 ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Marc Schwartz
2006-Jul-14 12:26 UTC
[R] Generating random normal distribution with mean 0 and standard deviation 1
On Fri, 2006-07-14 at 08:14 -0400, Neuro LeSuperH?ros wrote:> Hello, > > This must be really simple, but I can't find it on R Site search. I need to > generate a random normally distributed series with mean 0 and sd 1. In > Matlab, this code is randn(n). > > The closest I found is runif(20,-1,1) but this forces a maximum and a > minimum, and there's no way to specify a standard deviation of 1. > > >sd(runif(20,-1,1)) > [1] 0.578164help.search("normal") leads you to "Normal(stats)". ?Normal leads you to rnorm(). More generally, help.search("distributions") will give you an overview of the various distributions available in your installation. HTH, Marc Schwartz