Hi, I am a new user of R. I have 2 series of nominal data (2 series of answers for the same question) and I want to calculate the correlation between these 2 series. I've tried to use the correlation function (corr, ...) but all are for numeric data... Does anyone know what function should I use for the nominal data? Thanks a lot, Bianca
Hi, try ?cor but. I doubt it's your problem, and I think there's an another way to make correlation with nominal data, not used ?cor. But, i've been explore it yet. ex. : cbind(c("one","one","two","three","two","three"),c("one","three","three","three","two","two")) -> test> test[,1] [,2] [1,] "one" "one" [2,] "one" "three" [3,] "two" "three" [4,] "three" "three" [5,] "two" "two" [6,] "three" "two"> data.frame(test)X1 X2 1 one one 2 one three 3 two three 4 three three 5 two two 6 three two> data.frame(test) -> data> cor(data$X1,data$X2)[1] 0.5940885 I hope this helps, Unung On Wed, 2004-06-09 at 15:15, Bianca wrote:> Hi, > > I am a new user of R. I have 2 series of nominal data (2 series of answers > for the same question) and I want to calculate the correlation between these > 2 series. I've tried to use the correlation function (corr, ...) but all are > for numeric data... Does anyone know what function should I use for the > nominal data? > > Thanks a lot, > Bianca >
On 06/09/04 10:15, Bianca wrote:>Hi, > >I am a new user of R. I have 2 series of nominal data (2 series of answers >for the same question) and I want to calculate the correlation between these >2 series. I've tried to use the correlation function (corr, ...) but all are >for numeric data... Does anyone know what function should I use for the >nominal data?In part this is a statistics question, and the answer depends heavily on why you want to know. But one way to do it is to use Cohen's kappa. This is in the psy contributed packages, and described in our "Notes on R for psychology ..." (linked from my R search page - look under "inter-rater agreement"). Jon -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page: http://www.sas.upenn.edu/~baron R search page: http://finzi.psych.upenn.edu/