i Varadhan [mailto:rvarad...@jhmi.edu]
> Sent: Tuesday, March 29, 2011 4:41 PM
> To: Greg Snow
> Cc: r-help@r-project.org
> Subject: Re: RE: [R] Creating 3 vectors that sum to 1
>
> Hi Greg,
>
> Thanks.
>
> Here is one approach to speeding up the 1st method that I had
> s
On Tue, Mar 29, 2011 at 01:42:18PM -0600, Greg Snow wrote:
> Or we could expand a bit more:
>
> require(TeachingDemos)
> require(gtools)
>
> n <- 1000
> rtrg <- matrix(NA, n, 3)
> for (i in 1:n) rtrg[i,] <- diff(c(0, sort(runif(2)), 1))
>
> rtrg2 <- matrix(NA, n, 3)
> for (i in 1:n) {
> tmp <- r
stant Professor,
Division of Geriatric Medicine and Gerontology
School of Medicine
Johns Hopkins University
Ph. (410) 502-2619
email: rvarad...@jhmi.edu
- Original Message -
From: Greg Snow
Date: Tuesday, March 29, 2011 3:42 pm
Subject: RE: [R] Creating 3 vectors that sum to 1
To: Ravi V
# Corners are sparsely populated
> >
> > Ravi.
> > ____________________
> >
> > Ravi Varadhan, Ph.D.
> > Assistant Professor,
> > Division of Geriatric Medicine and Gerontology
> > School of Medicine
From: Ravi Varadhan [mailto:rvarad...@jhmi.edu]
> Sent: Tuesday, March 29, 2011 12:59 PM
> To: Ravi Varadhan
> Cc: Greg Snow; r-help@r-project.org
> Subject: Re: [R] Creating 3 vectors that sum to 1
>
>
> Here is an exploration of two different 3-tuple generators (that s
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Bert Gunter
> Sent: Tuesday, March 29, 2011 10:07 AM
> To: Petr Savicky; cddesjard...@gmail.com
> Cc: r-help@r-project.org
> Subject: Re: [R] Creating 3
Geriatric Medicine and Gerontology
School of Medicine
Johns Hopkins University
Ph. (410) 502-2619
email: rvarad...@jhmi.edu
- Original Message -
From: Ravi Varadhan
Date: Tuesday, March 29, 2011 2:33 pm
Subject: Re: [R] Creating 3 vectors that sum to 1
To: Greg Snow
Cc: "r-help@r-pro
Varadhan, Ph.D.
Assistant Professor,
Division of Geriatric Medicine and Gerontology
School of Medicine
Johns Hopkins University
Ph. (410) 502-2619
email: rvarad...@jhmi.edu
- Original Message -
From: Greg Snow
Date: Tuesday, March 29, 2011 1:02 pm
Subject: Re: [R] Creating 3 vectors that sum
So you want to generate random multinomials ? ...
Just generate random uniforms and divide by their sum!
z <- runif(3); z/sum(z)
## This can easily be modified to generate lots of random multinomial
3 vectors, e.g.
z <- matrix( runif(3*100), ncol=3)
z/rowSums(z) ## each row is a random multino
On 2011-03-29 09:20, Christopher Desjardins wrote:
I have 3 vectors: p1, p2, and p3. I would like each vector to be any
possible value between 0 and 1 and p1 + p2 + p3 = 1. I want to graph these
and I've thought about using scatterplot3d(). Here's what I have so far.
library(scatterplot3d)
p1<-
Do a search for Dirichlet, that may give you the tools you need. Also for
plotting 3 vectors that sum to 1, instead of a 3d scatter plot you should look
into a triangle or trilinear plot, see ?triplot in the TeachingDemos package
(the see also for that help page lists several other implementati
Please look at the triplot function in the klaR package.
The keyword is
RSiteSearch("barycentric")
Rich
On Tue, Mar 29, 2011 at 12:20 PM, Christopher Desjardins <
cddesjard...@gmail.com> wrote:
> I have 3 vectors: p1, p2, and p3. I would like each vector to be any
> possible value between 0 an
On Tue, Mar 29, 2011 at 11:20:13AM -0500, Christopher Desjardins wrote:
> I have 3 vectors: p1, p2, and p3. I would like each vector to be any
> possible value between 0 and 1 and p1 + p2 + p3 = 1. I want to graph these
> and I've thought about using scatterplot3d(). Here's what I have so far.
>
>
13 matches
Mail list logo