Re: [R] Generation of correlated variables

2012-03-16 Thread Petr Savicky
On Thu, Mar 15, 2012 at 11:23:28PM -, Ted Harding wrote: On 15-Mar-2012 Filoche wrote: Hi everyone. Based on a dependent variable (y), I'm trying to generate some independent variables with a specified correlation. For this there's no problems. However, I would like that have all

Re: [R] Generation of correlated variables

2012-03-16 Thread Petr Savicky
On Thu, Mar 15, 2012 at 10:48:48AM -0700, Filoche wrote: Hi everyone. Based on a dependent variable (y), I'm trying to generate some independent variables with a specified correlation. For this there's no problems. However, I would like that have all my regressors to be orthogonal (i.e. no

[R] Generation of correlated variables

2012-03-15 Thread Filoche
Hi everyone. Based on a dependent variable (y), I'm trying to generate some independent variables with a specified correlation. For this there's no problems. However, I would like that have all my regressors to be orthogonal (i.e. no correlation among them. For example, y = x1 + x2 + x3 where

Re: [R] Generation of correlated variables

2012-03-15 Thread Rui Barradas
Hello, However, I would like that have all my regressors to be orthogonal (i.e. no correlation among them. ?poly poly(cbind(x1, x2, x3), degree=1) Hope this helps, Rui Barradas -- View this message in context:

Re: [R] Generation of correlated variables

2012-03-15 Thread Filoche
Hi there. This is not really working. Here what I have for the moment. library(ecodist) x - 1:100 y1 - corgen(x=x, r=.85, epsilon=.01)$y y2 - corgen(x=x, r=.5, epsilon=.01)$y y3 - corgen(x=x, r=.25, epsilon=.01)$y a = poly(cbind(y1, y2, y3), degree=1) cor(a[,1], a[,2]) In that case, the

Re: [R] Generation of correlated variables

2012-03-15 Thread Petr Savicky
On Thu, Mar 15, 2012 at 10:48:48AM -0700, Filoche wrote: Hi everyone. Based on a dependent variable (y), I'm trying to generate some independent variables with a specified correlation. For this there's no problems. However, I would like that have all my regressors to be orthogonal (i.e. no

Re: [R] Generation of correlated variables

2012-03-15 Thread Filoche
Thank you everyone for your precious advice. I'll take time to look at it and try to make it work. Regards, Phil -- View this message in context: http://r.789695.n4.nabble.com/Generation-of-correlated-variables-tp4475799p4476346.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Generation of correlated variables

2012-03-15 Thread Rui Barradas
Hello, again. This is not really working. Here what I have for the moment. Right, I've read only half of the description line of function 'poly'. The other half states that These are all orthogonal to the constant polynomial of degree 0. But not pairwise orthogonal. You can look for

Re: [R] Generation of correlated variables

2012-03-15 Thread Bert Gunter
Rui: Try reading it again. Orthogonal polynomials are generated (subject to the caveats regarding machine precision stated therein). Note, especially, the raw argument. Cheers, Bert On Thu, Mar 15, 2012 at 1:06 PM, Rui Barradas rui1...@sapo.pt wrote: Hello, again. This is not really

Re: [R] Generation of correlated variables

2012-03-15 Thread Ted Harding
On 15-Mar-2012 Filoche wrote: Hi everyone. Based on a dependent variable (y), I'm trying to generate some independent variables with a specified correlation. For this there's no problems. However, I would like that have all my regressors to be orthogonal (i.e. no correlation among them).