Dear Leila
Does the function mvrnorm in package MASS do what you want?
On 11/11/2015 08:38, leila zamani via R-help wrote:
Hi every one,
I'm new to R. I read about R and search all the packages but I couldn't find
the package that I want. I want to generate 2D (matrices) random numbers that
h
Hi,
This generate matrix:
matrix( rnorm(5*4,mean=0,sd=1), 5, 4)
for correlated matrix please see this link:
http://stackoverflow.com/questions/10680658/how-can-i-create-a-correlation-matrix-in-r
Karim
On Wed, Nov 11, 2015 at 9:38 AM, leila zamani via R-help <
r-help@r-project.org> wrote:
> Hi e
Hi every one,
I'm new to R. I read about R and search all the packages but I couldn't find
the package that I want. I want to generate 2D (matrices) random numbers that
have correlation between them. One of my friends said that R has a function in
geor like rand...(spherical (correlation coeffic
2013/2/18 Daniel Nordlund :
>> -Original Message-
>> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
>> On Behalf Of Mauricio Zambrano-Bigiarini
>> Sent: Monday, February 18, 2013 1:33 AM
>> To: r-help@r-project.org
>> Subject:
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of Mauricio Zambrano-Bigiarini
> Sent: Monday, February 18, 2013 1:33 AM
> To: r-help@r-project.org
> Subject: [R] Random number generator used in 'runif
age-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Mauricio
> Zambrano-Bigiarini
> Sent: 18 February 2013 09:33
> To: r-help@r-project.org
> Subject: [R] Random number generator used in 'runif'
>
> Dear list,
>
>
Dear All,
I have three classes of questions about generating random numbers with
different packages (windows xp 32bit R).
.
1. Suppose I would like to use package *foreach*, can I use current
Sys.time as a seed?
Although I can get the time up to1e-6 second precesion, the code below dose
not work w
Thank you guys for all the help. I appreciate!
--
View this message in context:
http://r.789695.n4.nabble.com/Random-number-generation-tp3685463p3686392.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of Dennis Murphy
> Sent: Thursday, July 21, 2011 8:55 PM
> To: karena
> Cc: r-help@r-project.org
> Subject: Re: [R] Random number generation
>
> Hi
Hi:
Here's one way using uniform(0, 1) pseudo-random numbers, but there
are many ways you could go about this.
# each row comprises a set of three pseudo-random numbers
u <- matrix(runif(30), nrow = 10)
# divide each element in a row by its row sum
v <- t(apply(u, 1, function(x) x/sum(x)))
rowSum
To Jason: Still thank you, your reply gives me some clue about how to do
this.
To Duncan: Thank you for rely. It helped.
Karena
--
View this message in context:
http://r.789695.n4.nabble.com/Random-number-generation-tp3685463p3685821.html
Sent from the R help mailing list archive at Nabble.com
Could this possibly be a homework question?
cheers,
Rolf Turner
On 22/07/11 11:18, karena wrote:
Hi,
I want to generate multiple sets of random numbers.
The requirement is that:
1) each set have 3 random numbers;
2) the sum of the three number is always 1.
how to do this?
On 21/07/2011 7:18 PM, karena wrote:
Hi,
I want to generate multiple sets of random numbers.
The requirement is that:
1) each set have 3 random numbers;
2) the sum of the three number is always 1.
how to do this?
There are lots of ways. What is the context? It would determine the
first two
On 07/21/2011 08:04 PM, Jason Edgecombe wrote:
On 07/21/2011 07:18 PM, karena wrote:
Hi,
I want to generate multiple sets of random numbers.
The requirement is that:
1) each set have 3 random numbers;
2) the sum of the three number is always 1.
how to do this?
Try this:
df<-data.frame(a
On 07/21/2011 07:18 PM, karena wrote:
Hi,
I want to generate multiple sets of random numbers.
The requirement is that:
1) each set have 3 random numbers;
2) the sum of the three number is always 1.
how to do this?
Try this:
df<-data.frame(a=runif(10),b=runif(10))
df$c=df$a+df$b
d
Hi,
I want to generate multiple sets of random numbers.
The requirement is that:
1) each set have 3 random numbers;
2) the sum of the three number is always 1.
how to do this?
thank you,
karena
--
View this message in context:
http://r.789695.n4.nabble.com/Random-number-generation-tp3685463p
If this is about (pseudo) random number generation (yes, please use a
sensible subject line). See ?set.seed, ?runif, ?rnorm to get started.
Uwe Ligges
On 11.10.2010 19:32, Margaretta 2014 wrote:
Hello.
I would be very grateful if you could help me in using R.
I need R commands of pseudo random
On 16-Aug-10 07:35:58, Linda Eaton wrote:
> I am trying to get documentation about the random number generator
> used in "sample". The help for sample does not mention it. Can
> anyone point me in the right direction.
>
> Thanks
The place the "read all about it" is
?RNG
Agreed that ?sample g
Le 16/08/10 09:35, Linda Eaton a écrit :
I am trying to get documentation about the random number generator used in
"sample". The help for sample does not mention it. Can anyone point me in
the right direction.
Thanks
Hi,
You can follow the white rabbit into the code burrow.
> sample
funct
I am trying to get documentation about the random number generator used in
"sample". The help for sample does not mention it. Can anyone point me in
the right direction.
Thanks
[[alternative HTML version deleted]]
__
R-help@r-project.org ma
On Sat, 6 Feb 2010, Patrick Burns wrote:
A couple comments.
Although pseudo-random numbers were originally
used because of necessity rather than choice,
there is a definite upside to using them. That
upside is that the computations become reproducible
if you set the seed first (see 'set.seed')
A couple comments.
Although pseudo-random numbers were originally
used because of necessity rather than choice,
there is a definite upside to using them. That
upside is that the computations become reproducible
if you set the seed first (see 'set.seed').
I tend to encourage skepticism at pretty
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of b k
> Sent: Friday, February 05, 2010 2:04 PM
> To: r-help@r-project.org
> Subject: [R] Random number quality
>
> Hello,
>
> I'm run
Hello,
I'm running R 2.10.1 on Windows Vista. I'm selecting a random sample of
several hundred items out of a larger population of several thousand. I
realize there is srswor() in package sampling for exactly this purpose, but
as far as I can tell it uses the native PRNG which may or may not be ra
l.min,max=interval.max)
data.frame(letters2,rand.nums)
HTH,
Daniel
-
cuncta stricte discussurus
-
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Maithili Shiva
Sent: Thursday, December 17,
Dear R helpers
I am having following data
Name Numbers
A 25
B 3
C 13
A 5
B 7
C 0
A 2
B 10
C 9
CONDITIONS
If Name is
Ashta wrote:
Hi All,
I have the matrix called 'X' with 200 rows and 12 variables. I want to
create 2 new variables (V1 and V2) based on random number generator
p1<-rnorm(200. mean=0, std=1)
p2<-rnorm(200. mean=0, std=1)
x <- cbind(x, v1=ifelse(x[,'p1'] > 0.4, 1, 0), v2=ifelse(x[,'p2'] > 0.6
Hi Ashta,
On Sun, Oct 11, 2009 at 4:06 PM, Ashta <> wrote:
> Hi All,
> I have the matrix called 'X' with 200 rows and 12 variables. I want to
> create 2 new variables (V1 and V2) based on random number generator
>
> p1<-rnorm(200. mean=0, std=1)
> p2<-rnorm(200. mean=0, std=1)
>
Hi All,
I have the matrix called 'X' with 200 rows and 12 variables. I want to
create 2 new variables (V1 and V2) based on random number generator
p1<-rnorm(200. mean=0, std=1)
p2<-rnorm(200. mean=0, std=1)
x <- cbind(x, v1=ifelse(x[,'p1'] > 0.4, 1, 0), v2=ifelse(x[,'p2'] > 0.6, 0,
1))
I found
On Jun 19, 2009, at 10:25 AM, Alexandre Lockhart wrote:
My other question involved formatting my output. Normally, my text
file has 8 columns, each column with 500 values before the next 8
below are generated, and so on until 28 are reached. I have
examined formatting issues with each f
[1], x[2]))
sink()
> From: marc_schwa...@me.com
> To: jholt...@gmail.com
> Date: Thu, 18 Jun 2009 15:23:06 -0500
> CC: r-help@r-project.org; alexandre_geor...@hotmail.com
> Subject: Re: [R] Random number datasets help
>
> Quite true Jim, however I focused on his request and not hi
You're absolutely right, Marc.
Thanks
> From: marc_schwa...@me.com
> To: jholt...@gmail.com
> Date: Thu, 18 Jun 2009 15:23:06 -0500
> CC: r-help@r-project.org; alexandre_geor...@hotmail.com
> Subject: Re: [R] Random number datasets help
>
> Quite true Jim, howeve
Quite true Jim, however I focused on his request and not his code,
presuming that he did not realize what he was doing as a consequence
of the nested loops.
Perhaps Alexandre can provide clarification?
Regards,
Marc
On Jun 18, 2009, at 2:46 PM, jim holtman wrote:
That is not what his 'for
That is not what his 'for' loops are doing. He is iterating through all
combinations and would have created 784. So his problem statement did not
match the code that he sent.
On Thu, Jun 18, 2009 at 2:12 PM, Marc Schwartz wrote:
> Alexandre did say 28 datasets, not 784 (28 * 28)
>
> Thus,
On Jun 18, 2009, at 1:10 PM, Alexandre Lockhart wrote:
Hello:
My problem is that I have a data frame of means, and a data frame of
standard deviations which match up to each mean. I have been trying
to create 500 random numbers in a given dataset for each mean/sd
combination, but I am
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf Of Henrique Dallazuanna
> Sent: Thursday, June 18, 2009 10:52 AM
> To: Alexandre Lockhart
> Cc: r-help@r-project.org
> Subject: Re: [R] Random number datasets he
Alexandre did say 28 datasets, not 784 (28 * 28)
Thus, either:
mapply(rnorm, n = 500, mean = a1, sd = a2)
or
apply(cbind(a1, a2), 1, function(x) rnorm(500, x[1], x[2]))
HTH,
Marc Schwartz
On Jun 18, 2009, at 12:51 PM, Henrique Dallazuanna wrote:
Try this also:
a <- expand.grid(a
Try this also:
a <- expand.grid(a1, a2)
x <- mapply(rnorm, n = 500, mean = a[,1], sd = a[,2])
On Thu, Jun 18, 2009 at 2:10 PM, Alexandre Lockhart <
alexandre_geor...@hotmail.com> wrote:
>
> Hello:
>
> My problem is that I have a data frame of means, and a data frame of
> standard deviations whic
try this:
>
a1<-c(178.07,178.28,178.08,177.74,177.04,178.17,177.58,57.71,59.6,60.92,59.48,59.32,61.59,59.94,28.9,29.82,30.73,25.68,27.93,28.98,29.76,123.48,127.27,127.8,127.2,127.13,126.71,125.5)
>
a2<-c(1.69,1.3,1,.18,1.53,1.31,1.35,1.83,1.56,1.12,.74,1.48,1.67,1.53,.95,.87,0.03,1.12,1.95,1.22,1.
Hello:
My problem is that I have a data frame of means, and a data frame of standard
deviations which match up to each mean. I have been trying to create 500
random numbers in a given dataset for each mean/sd combination, but I am only
able to generate the last value in each data set to creat
See the lmom package by J.R.M Hosking
or
lmomco package by W.H.Asquith
-wha
On Feb 24, 2009, at 5:46 AM, Maithili Shiva wrote:
Dear R helpers
How to generate random numbers for
(a) Generalized logistic distribution
(b) Generalized normal distribution
(c) Pearson Type III distribution
(
Dear R helpers
How to generate random numbers for
(a) Generalized logistic distribution
(b) Generalized normal distribution
(c) Pearson Type III distribution
(d) Kappa
Thanks in advance
Maithili
__
R-help@r-project.org mailing list
https://st
Dear Maithili,
For (1) see [1] and for (2) see page 24 in [2].
HTH,
Jorge
[1] http://www.stat.ucl.ac.be/ISdidactique/Rhelp/library/evd/html/gev.html
[2] http://cran.r-project.org/web/packages/fExtremes/fExtremes.pdf
On Thu, Dec 18, 2008 at 3:17 AM, Maithili Shiva wrote:
> Hi R helpers,
>
>
>
Hi R helpers,
Is there any function in R, which generates random numbers in case of
(1) Generalized Extreme Value distribution and
(2) Generalized PAreto distribution for the respective given set of parameters?
Regards
Maithili
__
R-help@r-pro
s message in context:
http://www.nabble.com/R-random-number-generation-tp20138441p20142412.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the
means i should get
> 30 sequences.but am getting only one sequence .please help.
> this is my code
>
> y=0;
> for (i in 1:3)
> {
> while(y!=i)
> {
> y=sample(1:3,replace=TRUE);
> }
> }
>
>
--
View this message in context:
http://www.nabble.com/R-random-n
On 23-Oct-08 19:58:12, hiphop wrote:
>
> i have to generate random numbers from length 2 to 30 and
> length two should have the numbers 1,2 and length 3 should
> have the numbers 1,2,3 so on and so forth till size 30.
> i should get an sequence like 221 or 112 till both
> the values appear
should
get similar output for all sizes which means i should get 30 sequences.but
am getting only one sequence .please help.
this is my code
y=0;
for (i in 1:3)
{
while(y!=i)
{
y=sample(1:3,replace=TRUE);
}
}
--
View this message in context:
http://www.nabble.com/R-random-number-generation
Please don't cross-post. I've replied in R-devel.
On 8/5/2008 8:47 AM, subramanian R wrote:
Hi All,
I have a few queries regarding Random Number generation in R.
according to the help(Random.User) i defined my own functions for
user_unif_rand and user_norm_rand (uniform an
Hi All,
I have a few queries regarding Random Number generation in R.
according to the help(Random.User) i defined my own functions for
user_unif_rand and user_norm_rand (uniform and normal distribution)
But what i figured out was even when i call rexp,rpois,rgeom
This is perfect, thanks! :)
Jorge Ivan Velez pretended :
Hi Max,
See ?write.table. Perhaps:
MAT <- matrix(runif(1 * 6), 1, 6)
# TXT format
write.table(MAT,
"C:/yourmatrix.txt",col.names=FALSE,row.names=FALSE,quote=FALSE)
# XLS format
write.table(MAT,
"C:/yourmatrix.xls",col.names=FA
m <- runif(6)
mm <- matrix(m, ncol=6)
HTH
Dave
On Thu, Jul 31, 2008 at 6:24 PM, Max <[EMAIL PROTECTED]> wrote:
> Hi Everyone,
>
> I did a quick search of the list and it looks like this may not have been
> asked before... I'm trying to generate a matrix of random numbers between 0
> and 1,
?write.table
could help
PF
2008/7/31 Max <[EMAIL PROTECTED]>:
> Marc,
>
> this is very handy. My next question is, do you know a quick and easy way to
> transfer all of the output to a txt file? (or .xls)?
>
> Thanks,
>
> -Max
>
>
> Marc Schwartz explained on 07/31/2008 :
>>
>> on 07/31/2008 12:
Hi Max,
See ?write.table. Perhaps:
MAT <- matrix(runif(1 * 6), 1, 6)
# TXT format
write.table(MAT,
"C:/yourmatrix.txt",col.names=FALSE,row.names=FALSE,quote=FALSE)
# XLS format
write.table(MAT,
"C:/yourmatrix.xls",col.names=FALSE,row.names=FALSE,quote=FALSE,sep="\t")
HTH,
Jorge
On
Marc,
this is very handy. My next question is, do you know a quick and easy
way to transfer all of the output to a txt file? (or .xls)?
Thanks,
-Max
Marc Schwartz explained on 07/31/2008 :
on 07/31/2008 12:24 PM Max wrote:
Hi Everyone,
I did a quick search of the list and it looks like t
on 07/31/2008 12:24 PM Max wrote:
Hi Everyone,
I did a quick search of the list and it looks like this may not have
been asked before... I'm trying to generate a matrix of random numbers
between 0 and 1, with 6 columns, 1 rows. About all I know is that
runif(1) gives me the random number
Hi Everyone,
I did a quick search of the list and it looks like this may not have
been asked before... I'm trying to generate a matrix of random numbers
between 0 and 1, with 6 columns, 1 rows. About all I know is that
runif(1) gives me the random number I'm looking for.
Any help would b
On 5/13/2008 1:38 PM, Greg Snow wrote:
-Original Message-
From: Esmail Bonakdarian [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 13, 2008 8:13 AM
To: Greg Snow
Cc: Prof Brian Ripley; [EMAIL PROTECTED]
Subject: Re: [R] Random number generation
Greg Snow wrote:
>> -Original M
> -Original Message-
> From: Esmail Bonakdarian [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, May 13, 2008 8:13 AM
> To: Greg Snow
> Cc: Prof Brian Ripley; [EMAIL PROTECTED]
> Subject: Re: [R] Random number generation
>
> Greg Snow wrote:
> >> -Original M
Esmail Bonakdarian:
>> you could always run your R scripts through the C preproccessor and
> > have it strip the block comments for you.
>
> Too much work, call me old school, but I like the computer do work for me,
> rather than the other way around
Most editors (and every editor worth using) s
Greg Snow wrote:
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Esmail Bonakdarian
Sent: Sunday, May 11, 2008 7:25 AM
To: Prof Brian Ripley
Cc: [EMAIL PROTECTED]
Subject: Re: [R] Random number generation
[snip]
What I read doesn't seem
On Behalf Of Esmail Bonakdarian wrote:
> ...
> What I read doesn't seem to be incorrect however (it may even
> have been an archived message here), the *language* itself
> does not seem to support block *comments*. Using conditional
> constructs, or an IDE/editor to achieve similar results is a
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Esmail Bonakdarian
> Sent: Sunday, May 11, 2008 7:25 AM
> To: Prof Brian Ripley
> Cc: [EMAIL PROTECTED]
> Subject: Re: [R] Random number generation
[snip]
> What I read does
Hello there,
Prof Brian Ripley wrote:
On Sun, 11 May 2008, Esmail Bonakdarian wrote:
Stephan Kolassa wrote:
Have you tried successively removing/commenting parts of the script
before the sample() command until the problem goes away? That way you
should be able to pinpoint the offending scr
On Sun, 11 May 2008, Esmail Bonakdarian wrote:
Stephan Kolassa wrote:
Have you tried successively removing/commenting parts of the script before
the sample() command until the problem goes away? That way you should be
able to pinpoint the offending script command.
Hi,
This brings up a que
Stephan Kolassa wrote:
Have you tried successively removing/commenting parts of the script
before the sample() command until the problem goes away? That way you
should be able to pinpoint the offending script command.
Hi,
This brings up a question I have .. is there a way to do *block* comm
Dennis,
I assume that there is a set.seed() somewhere in your script, possibly
in something you source()d (hopefully not in anything library()d).
Have you tried successively removing/commenting parts of the script
before the sample() command until the problem goes away? That way you
should b
Colleagues,
I have encountered behavior of random number generation that eludes me.
I generate a random integer in a particular range using the following
code:
sample(1000:, size=1)
This code exists within a script that starts with the command:
remove(list=ls())
Each time
68 matches
Mail list logo