The way the sample data is provided is not useful. I have re-built your data,
please find the dput() version below (and pls check whether I got it right...).
This is not my area of competence at all, but from what I see from the help
page is that the expected parameters are, among others:
x
You have multiple options. I will advertise my own solution - install
the package WGCNA, installation instructions at
http://labs.genetics.ucla.edu/horvath/CoexpressionNetwork/Rpackages/WGCNA/#cranInstall
then you can use the function
cp = corAndPvalue(t(genes), t(features)).
You need to
This post was called help before, I changed the Subject.
Thanks for the comments.
Here the example: (I have the two lists saved as .csv and I can open them in R)
Sheet one- Genes (10 genes expression, not binary, meaured in 10 cell lines)
genes
Genes Cell.line1 Cell.line2 Cell.line3
is perfectly correlated with col 2
col 3 is perfectly correlated with col 4
col 5 is perfectly correlated with col 6
David C
From: Patzelt, Edward [mailto:patz...@g.harvard.edu]
Sent: Tuesday, September 2, 2014 9:21 AM
To: David L Carlson
Cc: R-help@r-project.org
Subject: Re: [R] Correlation Matrix
: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Patzelt, Edward
Sent: Monday, September 1, 2014 7:47 AM
To: R-help@r-project.org
Subject: [R] Correlation Matrix with a Covariate
R Help -
I'm trying to run a correlation matrix with a covariate of age
R Help -
I'm trying to run a correlation matrix with a covariate of age and will
at some point will also want to covary other variables concurrently.
I'm using the psych package and have tried other methods such as writing
a loop to extract semi-partial correlations, but it does not seem to be
-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Patzelt, Edward
Sent: Monday, September 1, 2014 7:47 AM
To: R-help@r-project.org
Subject: [R] Correlation Matrix with a Covariate
R Help -
I'm trying to run a correlation matrix with a covariate of age and will
at some point will also want
Hi everybody.
I'm trying to do a correlation matrix in a list of files. Each file contains
2 columns: capt1 and capt2. For the example, I merged all in one
data.frame. My data also contains many missing data. The aim is to do a
correlation matrix for the same data for course (one correlation
Hello,
Instead of 'sum' use 'mean'
ok - apply(tbl, 2, function(x) mean(!is.na(x)) = 0.5)
cor(tbl[, ok], use=pairwise.complete.obs)
Hope this helps,
Rui Barradas
Em 29-05-2012 10:03, jeff6868 escreveu:
Hi everybody.
I'm trying to do a correlation matrix in a list of files. Each file
Hi,
unless you're dealing with heteroskedastic datas, the command *cor(x)* will
be enough, where *x* is your data matrix; in this function you can easily
select the method which has to be used: Pearson's, Kendall's or Spearman's
correlation.
--
View this message in context:
Could anyone can help me telling the way how I can build correlation matrix
in R? Thanks in advance.
--
View this message in context:
http://r.789695.n4.nabble.com/Correlation-Matrix-tp4630389.html
Sent from the R help mailing list archive at Nabble.com.
Thanks a lot. Suppose I want to use Pearson's method, then what I have to do?
--
View this message in context:
http://r.789695.n4.nabble.com/Correlation-Matrix-tp4630389p4630396.html
Sent from the R help mailing list archive at Nabble.com.
__
Hi Mahdi,
Look at the documentation for cor(), by typing ?cor or help(cor).
Pearson is the default and it is trivial to select the others. I
suggest you try searching google or reading R's documentation before
posting to the list. You may not understand it all, but it shows you
tried to work on
Josh:
A very nice, clear, polite, concise, and reasoned alternative to RTFM !
Probably should be templated somehow, given the volume of queries of
this sort that this list receives. (The posting guide is too involved
to serve in its stead.)
Cheers,
Bert
On Thu, May 17, 2012 at 9:31 AM,
thanks a lot dear. I will keep your advice in my mind.
--
View this message in context:
http://r.789695.n4.nabble.com/Correlation-Matrix-tp4630389p4630448.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing
Dear All,
I have been trying to find some code to enable this matrix to be generated,
but don't seem to find one in which the tau-b and p values are inserted
into the matrix. I have found a number that seem to require two matrices,
which is a bit clumsy.
Any guidance much appreciated.
Best,
Nick
I improved yesterday a bit your script (mostly according to station numbers
for the automatization). Here's the final version. thanks again!
filenames - list.files(pattern=\\_2008_reconstruit.csv$)
Sensors - paste(capteur_, 1:4, sep=)
Stations -substr(filenames,1,5)
nsensors - length(Sensors)
Hello Rui,
Thanks a lot for your answer.
Hou hoped that your script would help me?
I answer you: It is WON-DER-FUL!
It works very well! I had first some difficulties to adapt it to my data,
but I succeeded afterwords when I made a test between 2 stations.
It's not perfect yet (I still have to
Hello,
jeff6868 wrote
Dear users,
I'm quite a new french R-user, and I have a problem about doing a
correlation matrix.
I have temperature data for each weather station of my study area and for
each year (for example, a data file for the weather station N°1 for the
year 2009, a data
Dear users,
I'm quite a new french R-user, and I have a problem about doing a
correlation matrix.
I have temperature data for each weather station of my study area and for
each year (for example, a data file for the weather station N°1 for the year
2009, a data file for the N°2 for the year
I think it would be better to think of this as an estimation problem rather
than a selection problem. If the correlation matrix is of interest,
estimate the entire matrix. If you want to show that you can make decisions
on the basis of the matrix, then use the bootstrap to get a confidence
Hello.
I have a large dataset with sales pr month for 56 products with 10 months
and i have tried to see how the sales are correlated using
cor()
This has given me a 56X56 matrix with the R value for each product pair.
Most of these correlations are insignificant, and i want only to retain the
There have been two threads dealing with this in the last few weeks:
please search the recent archives for those threads for a good
discussion -- end result: Josh Wiley provided a useful little function
to do so that I'll copy below. RSeek.org is a good place to do your
searching.
spec.cor -
Looking over the code below, I think this patched version might return
a better answer:
spec.cor - function(dat, r, ...) {
x - cor(dat, ...)
x[upper.tri(x, TRUE)] - NA
i - which(abs(x) = r, arr.ind = TRUE)
data.frame(V1 = rownames(x)[i[,1]], V2 = colnames(x)[i[,2]], Value = x[i])
Hello,
Thank you for your replies. I cannot run the function rcor.test even when
having loaded package ltm. Perhaps it has to do with the fact that I am
using the latest version of R and this package wasn't created under that
version
The function corr.test in package psych works fine. Is
Hi,
one solution is to use sink. Check ?sink to see explanation and following
example.
sink(sink-examp.txt)
i - 1:10
outer(i, i, *)
sink()
Andrija
On Tue, Nov 1, 2011 at 10:43 AM, AlexC alexandre.chaus...@unil.ch wrote:
Hello,
Thank you for your replies. I cannot run the function rcor.test
Alexandre,
The output from corr.test is a list of matrices. To export one of those
matrices, simply specify which one you want:
Using the example from my previous note:
library(psych)
examp - corr.test(sat.act)
mat.c.p - lower.tri(examp$r)*examp$r + t(lower.tri(examp$p)*examp$p)
mat.c.p
Thank you for your quick reply and helpful advice.
Using this argument allows me to do what I needed to do
Now the only other thing I wanted to accomplish was to obtain the top half
of the matrix with p values
and the bottom half with the correlations, to observe the significant
correlations.
Alex,
corr.test in psych will give you a matrix of correlations, a matrix of sample
sizes, and a matrix of probabilities.
You can combine the correlations and the probabilities to form what you want:
try the following:
library(psych)
examp - corr.test(sat.act)
mat.c.p -
Hi,
rcor.test in library(ltm) will provide a correlation matrix with p-values on
the bottom-half of the matrix.
Mark
On 2011-10-26, at 7:03 AM, AlexC wrote:
Thank you for your quick reply and helpful advice.
Using this argument allows me to do what I needed to do
Now the only other
Hi,
I am currently working with a data set which contains a list of julian dates
of phenological (flowering, leaf growth etc.)
I obtained a correlation matrix by simply using the cor function with the
dataset cor(dataset,use=complete.obs)
that gives me a correlation matrix but the
I believe it has to do with the complete.obs choice and the presence
of NAs in your data. The differences should vanish with
pairwise.complete.obs but whether that's what you want is up to you.
Michael
On Tue, Oct 25, 2011 at 5:09 PM, AlexC alexandre.chaus...@unil.ch wrote:
Hi,
I am
Thank you all for your suggestions.
Sharad
--
View this message in context:
http://r.789695.n4.nabble.com/correlation-matrix-tp3891085p3894329.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
Hello Gurus
I have two correlation matrices 'xa' and 'xb'
set.seed(100)
d=cbind(x=rnorm(20)+1,
x1=rnorm(20)+1,
x2=rnorm(20)+1)
d1=cbind(x=rnorm(20)+2,
x1=rnorm(20)+2,
x2=rnorm(20)+2)
xa=cor(d,use='complete')
xb=cor(d1,use='complete')
I want to combine these two to get a third
What a pleasant post to respond to - with self-contained code. :)
heat-matrix(0,nrow=dim(xa)[1],ncol=dim(xa)[2])
heat[lower.tri(heat)]-xa[lower.tri(xa)]
heat[upper.tri(heat)]-xb[upper.tri(xb)]
diag(heat)-1
heat
HTH,
Daniel
1Rnwb wrote:
Hello Gurus
I have two correlation matrices 'xa' and
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of 1Rnwb
Sent: Tuesday, 11 October 2011 6:20 a.m.
To: r-help@r-project.org
Subject: [R] correlation matrix
Hello Gurus
I have two correlation matrices 'xa' and 'xb'
set.seed(100
And you might also consider packages like corrplot, corrgram etc. for
other plotting options of a correlation matrix.
They can be more informative than simply invoking image(heat)
What a pleasant post to respond to - with self-contained code. :)
okay so fixed what i need to do this way
finit=0
for(ri in 1:dim(xa)[1])
{
finit=finit+1
xc[ri,1:finit]-xa[ri,1:finit]
xc[1:finit,ri]-xb[1:finit,ri]
}
but getting error in heatmap.2
mycol - colorpanel(n=40,low=red,mid=white,high=blue)
heatmap.2(xc, breaks=pairs.breaks, col=mycol, Rowv=FALSE,
Hello all,
I've run a Spearman's Rank test to discern relationships between landscape
characteristics and a specific aspect of river behaviour.
I've executed a correlation matrix between the one dependent variable and
all of the predictors, which gives me a nice output of Spearman's Rho
values.
?cor.test
cor.test(x, y, method = spearman)$p.value
HTH,
Jorge
On Tue, Aug 9, 2011 at 8:44 AM, ScottM wrote:
Hello all,
I've run a Spearman's Rank test to discern relationships between landscape
characteristics and a specific aspect of river behaviour.
I've executed a correlation matrix
Cheers Jorge,
I've tried this, but keep getting error messages, relating to either:
Error: unexpected '$' in $
or
Error in cor(data, method = spearman)$p.value :
$ operator is invalid for atomic vectors
Very annoying!
S
Scott McGrane MA (Hons), MRes
SAGES Theme 1 PhD Student
Northern
Just pointing out that Jorge wrote
cor.test
not cor.
Don't know if you saw that but it should help.
Michael Weylandt
On Aug 9, 2011, at 8:58 AM, ScottM scott.mcgr...@abdn.ac.uk wrote:
Cheers Jorge,
I've tried this, but keep getting error messages, relating to either:
Error:
Works for me:
x - rnorm(10)
y - rnorm(10)
cor.test(x, y, method = 'spearman')$p.value
[1] 0.166058
What are the classes of your inputs? A reproducible example would be
helpful. From the help page of cor.test():
x, y numeric vectors of data values. x and y must have the same length.
Do
Listers,
I have a question regarding correlation matrices. It is fairly straight
forward to build a correlation matrix of an entire data frame. I simply use
the command cor(MyDataFrame). However, what I would like to do is construct
a smaller correlation matrix using just three of the variable
On 7 April 2011 12:09, Dmitry Berman ravenb...@gmail.com wrote:
Listers,
I have a question regarding correlation matrices. It is fairly straight
forward to build a correlation matrix of an entire data frame. I simply use
the command cor(MyDataFrame). However, what I would like to do is
Hi Dmitry,
You might try
with(MyDataFrame[, 1:3])
is variable1, variable2 and variable3 correspond to the first three columns
of your data, or
with( MyDataFrame( cor( cbind( variable1, variable2, variable3) ) ) )
otherwise.
HTH,
Jorge
On Thu, Apr 7, 2011 at 3:09 PM, Dmitry Berman wrote:
I am sorry for the noise, but
with(MyDataFrame[, 1:3])
should have been
with(cor(MyDataFrame[, 1:3]))
Best,
Jorge
On Thu, Apr 7, 2011 at 3:21 PM, Jorge Ivan Velez wrote:
Hi Dmitry,
You might try
with(MyDataFrame[, 1:3])
is variable1, variable2 and variable3 correspond to the first
On Apr 7, 2011, at 3:09 PM, Dmitry Berman wrote:
Listers,
I have a question regarding correlation matrices. It is fairly
straight
forward to build a correlation matrix of an entire data frame. I
simply use
the command cor(MyDataFrame). However, what I would like to do is
construct
a
Hi ,
you can try using cov2cor(vcov(lm(calorie~height))) to get the correlation
matrix of estimated coefficients
boltonboy999 wrote:
Hi everyone,
This is pretty urgent so if anyone can help that would be great.
I have a table of information. The categories are weight, height,
If your purpose is simply to represent a correlation matrix it in a more
compact way see ?symnum, the corrgram package and an example in the
book Multivariate Data Visualization (regarding which gives a lattice
implementation).
On Fri, Mar 7, 2008 at 2:15 PM, Martin Kaffanke
On the topic of visualizing correlation, see also
Murdoch, D.J. and Chow, E.D. (1996). A graphical display of large
correlation matrices.
The American Statistician 50, 178-180.
with examples here:
# install.packages('ellipse')
example(plotcorr, package='ellipse')
On Sat, Mar 8, 2008 at 3:01
Am Mittwoch, den 05.03.2008, 14:38 -0300 schrieb Henrique Dallazuanna:
Try this:
On 05/03/2008, Martin Kaffanke [EMAIL PROTECTED] wrote:
Hi there!
In my case,
cor(d[1:20])
makes me a good correlation matrix.
Now I'd like to have it one sided, means only the left bottom
Please provide a example of what you want
On 06/03/2008, Martin Kaffanke [EMAIL PROTECTED] wrote:
Am Mittwoch, den 05.03.2008, 14:38 -0300 schrieb Henrique Dallazuanna:
Try this:
On 05/03/2008, Martin Kaffanke [EMAIL PROTECTED] wrote:
Hi there!
In my case,
On 3/6/2008 2:07 PM, Martin Kaffanke wrote:
Am Mittwoch, den 05.03.2008, 14:38 -0300 schrieb Henrique Dallazuanna:
Try this:
On 05/03/2008, Martin Kaffanke [EMAIL PROTECTED] wrote:
Hi there!
In my case,
cor(d[1:20])
makes me a good correlation matrix.
Now I'd like to have it one
Hi there!
In my case,
cor(d[1:20])
makes me a good correlation matrix.
Now I'd like to have it one sided, means only the left bottom side to be
printed (the others are the same) and I'd like to have * where the
p-value is lower than 0.05 and ** lower than 0.01.
How can I do this?
And
Try this:
On 05/03/2008, Martin Kaffanke [EMAIL PROTECTED] wrote:
Hi there!
In my case,
cor(d[1:20])
makes me a good correlation matrix.
Now I'd like to have it one sided, means only the left bottom side to be
printed (the others are the same) and I'd like to have * where the
Hello,
I cannot figure out how to use tapply to compute the correlation matrix
in the variable x between the states? The data is in long format, e.g.:
state,year,x
Alabama,2001,0.45
Alabama,2002,0.47
Alabama,2003,0.48
Alabama,2004,0.44
Arizona,2001,0.34
Arizona,2002,0.32
Arizona,2003,0.38
If I understand your question, you can try something like this:
cor(data.frame(lapply(split(x, x$state), [, 3)))
On 29/01/2008, Serguei Kaniovski [EMAIL PROTECTED] wrote:
Hello,
I cannot figure out how to use tapply to compute the correlation matrix
in the variable x between the states? The
Hello,
I have a dataset with 20,000 variables.and I would like to compute a pearson
correlation matrix which will be 2*2. The cor() function doesnt work
in this case due to memory problem. If you have any ideas regarding a
feasible way to compute correlations on such a huge dataset,
On Jan 8, 2008 12:34 AM, suman Duvvuru [EMAIL PROTECTED] wrote:
Hello,
I have a dataset with 20,000 variables.and I would like to compute a pearson
correlation matrix which will be 2*2. The cor() function doesnt work
in this case due to memory problem. If you have any ideas regarding
60 matches
Mail list logo