Re: [R] A vector of normal distributed values with a sum-to-zero constraint

2014-04-02 Thread peter dalgaard
creveu: >> Then what's wrong with centering your initial values around the mean? >> >> >> >> Marc Marí Dell'Olmo >> 04/01/2014 10:56 AM >> >> To >> Boris Steipe , >> cc >> jlu...@ria.buffalo.edu, "r-help@r-projec

Re: [R] A vector of normal distributed values with a sum-to-zero constraint

2014-04-02 Thread Frede Aakmann Tøgersen
-Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Marc Marí Dell'Olmo > Sent: 1. april 2014 16:57 > To: Boris Steipe > Cc: r-help@r-project.org > Subject: Re: [R] A vector of normal distributed values with a s

Re: [R] A vector of normal distributed values with a sum-to-zero constraint

2014-04-01 Thread Greg Snow
Here is one approach to generating a set (or in this case multiple sets) of normals that sum to 0 (with a little round off error) and works for an odd number of points: v <- matrix(-1/8, 9, 9) diag(v) <- 1 eigen(v) x <- mvrnorm(100,mu=rep(0,9), Sigma=v, empirical=TRUE) rowSums(x) range(.Last.value

Re: [R] A vector of normal distributed values with a sum-to-zero constraint

2014-04-01 Thread Rui Barradas
escreveu: Then what's wrong with centering your initial values around the mean? Marc Marí Dell'Olmo 04/01/2014 10:56 AM To Boris Steipe , cc jlu...@ria.buffalo.edu, "r-help@r-project.org" Subject Re: [R] A vector of normal distributed values with a sum-to-zero constraint

Re: [R] A vector of normal distributed values with a sum-to-zero constraint

2014-04-01 Thread JLucke
Then what's wrong with centering your initial values around the mean? Marc Marí Dell'Olmo 04/01/2014 10:56 AM To Boris Steipe , cc jlu...@ria.buffalo.edu, "r-help@r-project.org" Subject Re: [R] A vector of normal distributed values with a sum-to-zero constraint

Re: [R] A vector of normal distributed values with a sum-to-zero constraint

2014-04-01 Thread Keith Jewell
04/01/2014 09:29 AM To Marc Marí Dell'Olmo , cc "r-help@r-project.org" Subject Re: [R] A vector of normal distributed values with a sum-to-zero constraint Make a copy with opposite sign. This is Normal, symmetric, but no longer random. set.seed(112358) x <- rno

Re: [R] A vector of normal distributed values with a sum-to-zero constraint

2014-04-01 Thread Marc Marí Dell'Olmo
Thus the solution is >> > N <- 100 >> > x <- rnorm(N-1) >> > x <- c(x, -sum(x)) >> > sum(x) >> [1] -7.199102e-17 >> >> > >> >> >> >> >> >> >> >> >> Boris Stei

Re: [R] A vector of normal distributed values with a sum-to-zero constraint

2014-04-01 Thread Boris Steipe
> > > > > > > > > Boris Steipe > Sent by: r-help-boun...@r-project.org > 04/01/2014 09:29 AM > > To > Marc Marí Dell'Olmo , > cc > "r-help@r-project.org" > Subject > Re: [R] A vector of normal distributed values with a

Re: [R] A vector of normal distributed values with a sum-to-zero constraint

2014-04-01 Thread JLucke
ect.org 04/01/2014 09:29 AM To Marc Marí Dell'Olmo , cc "r-help@r-project.org" Subject Re: [R] A vector of normal distributed values with a sum-to-zero constraint Make a copy with opposite sign. This is Normal, symmetric, but no longer random. set.seed(112358) x <- r

Re: [R] A vector of normal distributed values with a sum-to-zero constraint

2014-04-01 Thread Boris Steipe
Make a copy with opposite sign. This is Normal, symmetric, but no longer random. set.seed(112358) x <- rnorm(5000, 0, 0.5) x <- c(x, -x) sum(x) hist(x) B. On 2014-04-01, at 8:56 AM, Marc Marí Dell'Olmo wrote: > Dear all, > > Anyone knows how to generate a vector of Normal distributed

Re: [R] A vector of normal distributed values with a sum-to-zero constraint

2014-04-01 Thread Jeff Newmiller
You are on a fool's errand. Read FAQ 7.31. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#.. De