Re: [R] simulate correlated binary, categorical and continuous variable

2012-04-04 Thread Greg Snow
How are you calculating the correlations? That may be part of the problem, when you categorize a continuous variable you get a factor whose internal representation is a set of integers. If you try to get a correlation with that variable it will not be the polychoric correlation. Also do you need

Re: [R] simulate correlated binary, categorical and continuous variable

2012-04-02 Thread Petr Savicky
On Sun, Apr 01, 2012 at 06:00:43PM -0700, Burak Aydin wrote: > Hello Greg, > Sorry for the confusion. > Lets say, I have a population. I have 6 variables. They are correlated to > each other. I can get you pearson correlation, tetrachoric or polychoric > correlation coefficients. > 2 of them conti

Re: [R] simulate correlated binary, categorical and continuous variable

2012-04-01 Thread Burak Aydin
Hello Greg, Sorry for the confusion. Lets say, I have a population. I have 6 variables. They are correlated to each other. I can get you pearson correlation, tetrachoric or polychoric correlation coefficients. 2 of them continuous, 2 binary, 2 categorical. Lets assume following conditions; Co1 and

Re: [R] simulate correlated binary, categorical and continuous variable

2012-04-01 Thread Burak Aydin
Hello David Duffy-2, I see that you just proved using rmvnorm and then dichotomize/categorize them should work. Thanks but please take a look at this link; http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/CatContinuous and this article; Analysis by Categorizing or Dichotomizing Continuous Vari

Re: [R] simulate correlated binary, categorical and continuous variable

2012-03-31 Thread Greg Snow
Your explanation below has me more confused than before. Now it is possible that it is just me, but it seems that if others understood it then someone else would have given a better answer by now. Are you restricting your categorical and binary variables to be binned versions of underlying normal

Re: [R] simulate correlated binary, categorical and continuous variable

2012-03-31 Thread David Duffy
Burak Aydin asked: Lets say I know Pearson covariance matrix. When I use rmvnorm to simulate 9 variables and then dichotomize/categorize them, I cant retrieve the population covariance matrix. library(polycor) sim1 <- function(thresh=0.5, r=0.3) { x <- rmvnorm(1000,c(0,0),matrix(c(1,r,r,1)

Re: [R] simulate correlated binary, categorical and continuous variable

2012-03-30 Thread Burak Aydin
Hello Greg, Thanks for your time, Lets say I know Pearson covariance matrix. When I use rmvnorm to simulate 9 variables and then dichotomize/categorize them, I cant retrieve the population covariance matrix. -- View this message in context: http://r.789695.n4.nabble.com/simulate-correlated-binar

Re: [R] simulate correlated binary, categorical and continuous variable

2012-03-30 Thread Greg Snow
Partly this depends on what you mean by a covariance between categorical variables (and binary) and what is a covariance between a categorical and a continuous variable? On Thu, Mar 29, 2012 at 12:31 PM, Burak Aydin wrote: > Hi, > I d like to simulate 9 variables; 3 binary, 3 categorical and 3 co

[R] simulate correlated binary, categorical and continuous variable

2012-03-29 Thread Burak Aydin
Hi, I d like to simulate 9 variables; 3 binary, 3 categorical and 3 continuous with a known covariance matrix. Using mvtnorm and later dichotimize/categorize variables is not efficient. Do you know any package or how to simulate mixed data? -- View this message in context: http://r.789695.n4.nabb