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
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
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
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
42 matches
Mail list logo