Skip to content
Back to formatted view

Raw Message

Message-ID: <CABsGe_yu0tc5NsQR7FWu5ckKMTG4sDUcrVRtdfAMNUVC0Ts-PA@mail.gmail.com>
Date: 2012-09-28T10:10:21Z
From: Johannes Radinger
Subject: Crosstable-like analysis (ks test) of dataframe

Hi,

I have a dataframe with multiple (appr. 20) columns containing
vectors of different values (different distributions).
 Now I'd like to create a crosstable
where I compare the distribution of each vector (df-column) with
each other. For the comparison I want to use the ks.test().
The result should contain as row and column names the column names
of the input dataframe and the cells should be populated with
the p-value of the ks.test for each pairwise analysis.

My data.frame looks like:
df <- data.frame(X=rnorm(1000,2),Y=rnorm(1000,1),Z=rnorm(1000,2))

And the test for one single case is:
ks <- ks.test(df$X,df$Z)

where the p value is:
ks[2]

How can I create an automatized way of this pairwise analysis?
Any suggestions? I guess that is a quite common analysis (probably with
other tests).

cheers,
Johannes