I'm trying to obtain within-group correlations on a subset of variables. I first selected my variables using the following command: mydata$x<-mydata[c("iq","education","achievement")]
I'd like to look at correlations among those variables separately for men and women. My gender variable in mydata is coded 1 (women) and 0 (men). I have successfully used the following to get within group correlations and p values: by(x,gender,function(x) rcorr(as.matrix(x))) However, I'm also interested in getting confidence intervals for the correlations as well, using cor.test. I tried the following without success. by(x,gender,function(x) cor.test(as.matrix(x))) Even if I just use 2 variables (e.g., IQ and education), I get exactly the same output for men and women with this command: by(x,gender,function(x) cor.test(iq,education)) I'm still in the learning stages with the by and cor.test functions, so I assume I'm using it incorrectly. Is it possible to get the correlation confidence intervals for each group using this approach? Many thanks in advance! John -- View this message in context: http://www.nabble.com/Within-group-correlation-confidence-intervals-tp25509629p25509629.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.