Re: [R] random number generation

2015-11-11 Thread Michael Dewey
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

Re: [R] random number generation

2015-11-11 Thread Karim Mezhoud
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

Re: [R] Random number generation

2011-07-22 Thread Daniel Nordlund
-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: Here's one way using uniform(0, 1

Re: [R] Random number generation

2011-07-22 Thread karena
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

Re: [R] Random number generation

2011-07-21 Thread Jason Edgecombe
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

Re: [R] Random number generation

2011-07-21 Thread Jason Edgecombe
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:

Re: [R] Random number generation

2011-07-21 Thread Duncan Murdoch
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

Re: [R] Random number generation

2011-07-21 Thread Rolf Turner
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?

Re: [R] Random number generation

2011-07-21 Thread karena
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

Re: [R] Random number generation

2011-07-21 Thread Dennis Murphy
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)))

Re: [R] Random Number Generation in a Loop

2009-12-16 Thread Daniel Malter
Hi, does this do what you want to do? I take the first six lines of the data you provided. Note that letters corresponds to your Name, and number corresponds to your Numbers variable. letters=rep(c(A,B,C),2) letters number=c(25,3,13,5,7,0) number letters2=rep(letters,number) letters2

Re: [R] Random number generation for Generalized Logistic distribution

2009-02-24 Thread William Asquith
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

Re: [R] Random Number Generation using (Generalized) Extreme Value distribution and Pareto distribution

2008-12-18 Thread Jorge Ivan Velez
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

Re: [R] Random number generation

2008-08-05 Thread Duncan Murdoch
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

Re: [R] Random number generation

2008-07-31 Thread Marc Schwartz
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

Re: [R] Random number generation

2008-07-31 Thread Max
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

Re: [R] Random number generation

2008-07-31 Thread Jorge Ivan Velez
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 Thu,

Re: [R] Random number generation

2008-07-31 Thread Patrizio Frederic
?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:24 PM Max wrote:

Re: [R] Random number generation

2008-07-31 Thread David Barron
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, with 6

Re: [R] Random number generation

2008-07-31 Thread Max
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,

Re: [R] Random number generation

2008-05-13 Thread Jim Lemon
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 work

Re: [R] Random number generation

2008-05-13 Thread Esmail Bonakdarian
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

Re: [R] Random number generation

2008-05-13 Thread Karl Ove Hufthammer
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)

Re: [R] Random number generation

2008-05-13 Thread Greg Snow
-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 Message- [snip] you could always run

Re: [R] Random number generation

2008-05-13 Thread Duncan Murdoch
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 Message

Re: [R] Random number generation

2008-05-12 Thread Greg Snow
-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 to be incorrect however

Re: [R] Random number generation

2008-05-11 Thread Stephan Kolassa
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

Re: [R] Random number generation

2008-05-11 Thread Esmail Bonakdarian
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*

Re: [R] Random number generation

2008-05-11 Thread Prof Brian Ripley
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

Re: [R] Random number generation

2008-05-11 Thread Esmail Bonakdarian
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