[R] Correlation Matrix
vito_ricci at yahoo.com
Fri Oct 8 14:09:13 CEST 2004
many thanks for your suggestion: it's just I wished!
--- Sundar Dorai-Raj <sundar.dorai-raj at PDF.COM> ha
> Vito Ricci wrote:
> > Hi,
> > I'm dealing with a datamining analysis: I've a lot
> > categories of product sold per week (n. week =26,
> > categories about 50.
> > my dataframe is like this:
> > Settimana ALIMENTI..ALTRI. ALIMENTI.APROTEICI
> > 1 1 3 19
> > 2 2 2 0
> > 3 3 1 22
> > 4 4 2 6
> > I computed correlation coefficents among
> > having a correlation matrix (53X53). Now I will
> > extract from this matrix only significative
> > correlations, or, in alternative correlations >0.5
> > <-0.5, excluding the other, and put this
> > in a dataframe.
> > I'm looking for significative correlations among
> > categories.
> > Is someone could help me? Many thanks in advance.
> > Is also someone using R for dataminig analysis
> > me?
> > Vito
> Assuming `x' is your data above, how about the
> r <- cor(x)
> y <- which(lower.tri(r), TRUE)
> z <- data.frame(row = rownames(r)[y[, 1]],
> col = colnames(r)[y[, 2]],
> cor = r[y])
> subset(z, abs(cor) > 0.5)
> # row col cor
> # 1 ALIMENTI..ALTRI. Settimana -0.6324555
Diventare costruttori di soluzioni
"The business of the statistician is to catalyze
the scientific learning process."
George E. P. Box
Visitate il portale http://www.modugno.it/
e in particolare la sezione su Palese http://www.modugno.it/archivio/cat_palese.shtml
More information about the R-help