Re: [R] correlation by factor

2021-07-27 Thread Rui Barradas
Hello, And here are three more ways. I will put the data, corrected in Bert's post, in a data.frame. R <- c(1,8,3,6,7,2,3,7,2,3,3,4,3,7,3) Day <- c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,3) Freq <- paste0("a", rep(1:5,3)) df1 <- data.frame(R, Day, Freq) # Base R, as for the function, see Bert's post sa

Re: [R] correlation by factor

2021-07-27 Thread Bert Gunter
Well, first of all, your example is messed up. You missed the "c" in front of the ( in Freq <-; and all of the Freq entries need to be enclosed in quotes for proper syntax. A simpler way to do it is just to use paste() and rep(): Freq <- paste0("a", rep(1:5,3)) (If you are not familiar with such "

[R] correlation by factor

2021-07-27 Thread Marlin Keith Cox
I am having problems making a correlation/association between two variables by a factor. In the case below, I need to know the correlation between R and Day at each frequency (a1-a5). Each frequency would have a corresponding correlation between R and day. I have found a lm function that is simil

Re: [R] correlation between nominal and ordinal

2017-09-03 Thread David Winsemius
> On Sep 2, 2017, at 3:41 AM, Jim Lemon wrote: > > hi merlin, > Check out the hetcor package. I found a hetcor function in the polycor package. Another method might be to use the lrm function in the rms package. It supports proportional odds ordinal logistic regression models. -- David.

Re: [R] correlation between nominal and ordinal

2017-09-02 Thread Jim Lemon
hi merlin, Check out the hetcor package. Jim On Sat, Sep 2, 2017 at 6:25 AM, wrote: > I would be very grateful if you would tell me how I can find the degree of > correlation between a nominal dependent variable and an independent ordinal > variable. The nominal variable has only two levels: Y

Re: [R] correlation between nominal and ordinal

2017-09-01 Thread Mathew Guilfoyle
Any of the usual rank correlation methods should be fine if you're expecting a monotonic relationship e.g. Spearman's rho or Kendall's tau. > On 1 Sep 2017, at 21:25, merlinverde...@infomed.sld.cu wrote: > > I would be very grateful if you would tell me how I can find the degree of > correlatio

Re: [R] correlation between nominal and ordinal

2017-09-01 Thread Bert Gunter
Wrong list. This list is about programming in R, not statistics. Try stats.stackexchange.com instead for statistics questions. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloo

[R] correlation between nominal and ordinal

2017-09-01 Thread merlinverdecia
I would be very grateful if you would tell me how I can find the degree of correlation between a nominal dependent variable and an independent ordinal variable. The nominal variable has only two levels: YES and NO. thank you very much in advance regards, merlin -

Re: [R] Correlation between continuous and binary vectors.

2017-04-01 Thread David Winsemius
I suspect this has been discussed in the past in rhelp. My favorite search engine is Markmail Sent from my iPhone > On Mar 31, 2017, at 8:53 PM, Art U wrote: > > Hi, > I'm trying to create number of vectors, part of them are binary and part > are continuous. Is there a way in R to generate the

Re: [R] Correlation between continuous and binary vectors.

2017-04-01 Thread Boris Steipe
Yes. > On Mar 31, 2017, at 11:53 PM, Art U wrote: > > Hi, > I'm trying to create number of vectors, part of them are binary and part > are continuous. Is there a way in R to generate them with specific > correlation between each pair? > Thank you in advance. > Ariel > -- > *I like to pretend

[R] Correlation between continuous and binary vectors.

2017-04-01 Thread Art U
Hi, I'm trying to create number of vectors, part of them are binary and part are continuous. Is there a way in R to generate them with specific correlation between each pair? Thank you in advance. Ariel -- *I like to pretend I'm alone*. *Completely alone*. *Maybe post-apocalypse or plague*... *Wha

Re: [R] Correlation code not working but not sure why

2017-03-22 Thread John C Frain
I can't see anything wrong with your code. You should read the posting guide and produce a minimal example showing the problem and any other details requested there. If I take just the small sample of data that you have provided and run a slightly adapted version of your code data = read.table("q

[R] Correlation code not working but not sure why

2017-03-22 Thread Ashley Patton via R-help
Good afternoon, I was wondering if someone could help me with what I am sure is likely to be a really simple problem but I cannot work out what I have done wrong. I have tried searching the forums/Google etc but can't find anything quite like the code I am using other than things that do not di

Re: [R] Correlation between package output

2016-04-12 Thread Sarah Goslee
Hi Fabio, Using the first example from ?dbFD ex1 <- dbFD(dummy$trait, dummy$abun) If you look at that help page, or at str(ex1), you'll see that the returned object is a list with named components. So, you can access the different indices just as you would access any other list. If that's confus

[R] Correlation between package output

2016-04-11 Thread Fabio Monteiro
Hello I'm currently using the dbFD function of the FD package and i'm having some things that I can't do. Is there any way to check the relations between dbFD indexes? Function cor for example? I can't manage to put the informations correctly dbFD function gives a lot of output (indexes - nbsp,

Re: [R] correlation matricies: getting p-values?

2015-06-28 Thread David Winsemius
On Jun 28, 2015, at 10:03 AM, David Winsemius wrote: > > On Jun 27, 2015, at 8:06 PM, JAVAD BAYAT wrote: > >> Dear Bill Venables; >> >> Hi, I am using "cor" command to get the correlation coefficients for my data >> frame. I found somthing in the following site: " >>

Re: [R] correlation matricies: getting p-values?

2015-06-28 Thread Bert Gunter
?cor.test Please read Help files (for cor, which linked cor.test) before posting. And, as David says, post in plain text. -- Bert Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." -- Clifford Stoll On Sat, Jun 27, 2015 at 8:06 PM, J

Re: [R] correlation matricies: getting p-values?

2015-06-28 Thread David Winsemius
On Jun 27, 2015, at 8:06 PM, JAVAD BAYAT wrote: > Dear Bill Venables; > > Hi, I am using "cor" command to get the correlation coefficients for my data > frame. I found somthing in the following site: " > > https://stat.ethz.ch/pipe

[R] correlation matricies: getting p-values?

2015-06-28 Thread JAVAD BAYAT
Dear Bill Venables; Hi, I am using "cor" command to get the correlation coefficients for my data frame. I found somthing in the following site: " https://stat.ethz.ch/pipermail/r-help/2000-January/009758.html"; . I used your function

Re: [R] Correlation matrix for pearson correlation (r,p,BH(FDR))

2015-06-18 Thread Peter Langfelder
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 transpo

Re: [R] Correlation matrix for pearson correlation (r,p,BH(FDR))

2015-06-18 Thread Rainer Schuermann
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

[R] Correlation matrix for pearson correlation (r,p,BH(FDR))

2015-06-18 Thread Sarah Bazzocco
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 Ce

Re: [R] Correlation question

2015-02-22 Thread David L Carlson
1] -3.281849 David L. Carlson Department of Anthropology Texas A&M University -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jonathan Thayn Sent: Sunday, February 22, 2015 12:01 AM To: Kehl Dániel Cc: r-help@r-project.org Subject: Re: [R] Correlat

Re: [R] Correlation question

2015-02-21 Thread Jonathan Thayn
stu.edu] > Küldve: 2015. február 21. 22:42 > To: r-help@r-project.org > Tárgy: [R] Correlation question > > I recently compared two different approaches to calculating the correlation > of two variables, and I cannot explain the different results: > > data(cars) > m

Re: [R] Correlation question

2015-02-21 Thread Kehl Dániel
: Jonathan Thayn [jth...@ilstu.edu] Küldve: 2015. február 21. 22:42 To: r-help@r-project.org Tárgy: [R] Correlation question I recently compared two different approaches to calculating the correlation of two variables, and I cannot explain the different results: data(cars) model <- lm(dist~sp

[R] Correlation question

2015-02-21 Thread Jonathan Thayn
I recently compared two different approaches to calculating the correlation of two variables, and I cannot explain the different results: data(cars) model <- lm(dist~speed,data=cars) coef(model) fitted.right <- model$fitted fitted.wrong <- -17+5*cars$speed When using the OLS fitted values, the

Re: [R] correlation between categorical data

2015-01-28 Thread Heinz Tuechler
comment inline David Winsemius wrote on 24.01.2015 21:08: On Jan 23, 2015, at 5:54 PM, JohnDee wrote: Heinz Tuechler wrote At 07:40 21.06.2009, J Dougherty wrote: [...] There are other ways of regarding the FET. Since it is precisely what it says - an exact test - you can argue that you s

Re: [R] correlation between categorical data

2015-01-24 Thread David Winsemius
On Jan 23, 2015, at 5:54 PM, JohnDee wrote: > Heinz Tuechler wrote >> At 07:40 21.06.2009, J Dougherty wrote: >> >> [...] >>> There are other ways of regarding the FET. Since it is precisely >>> what it says >>> - an exact test - you can argue that you should avoid carrying over any >>> conclu

Re: [R] correlation between categorical data

2015-01-23 Thread JohnDee
Heinz Tuechler wrote > At 07:40 21.06.2009, J Dougherty wrote: > > [...] >>There are other ways of regarding the FET. Since it is precisely >>what it says >>- an exact test - you can argue that you should avoid carrying over any >>conclusions drawn about the small population the test was applied

Re: [R] Correlation Matrix with a Covariate

2014-09-02 Thread Patzelt, Edward
, TX 77840-4352 > > > -Original Message- > From: 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 &

Re: [R] Correlation Matrix with a Covariate

2014-09-02 Thread David L Carlson
1. col 1 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:

Re: [R] Correlation Matrix with a Covariate

2014-09-01 Thread David L Carlson
m: 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] Correlation Matrix with a Covariate

2014-09-01 Thread Patzelt, Edward
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 b

Re: [R] Correlation

2014-07-27 Thread Rui Barradas
Hello, If I understand it correctly the following should do it. Note that it removes both columns and rows. idx <- corData > 0.5 diag(idx) <- FALSE idx2 <- which(apply(idx, 2, function(x) !any(x))) corData[-idx2, -idx2] Use corData[, -idx2] to remove only columns. Hope this helps, Rui Bar

[R] Correlation

2014-07-27 Thread Nico Met
Dear all, I have written the following code for correlation calculations. I want to create a new matrix from corData) with correlation more than 0.5 only and the rest of the columns should be removed. How can I do it? set.seed(1234) data<-matrix(rnorm(100),nrow=10) data[,1]<-100*(data[,2]+data[

Re: [R] Correlation

2014-07-16 Thread PIKAL Petr
r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Robert Sherry > Sent: Wednesday, July 16, 2014 11:37 PM > To: r-help@r-project.org > Subject: [R] Correlation > > Please consider the following R Script: > x = c(1,2,3) > y = c(1,2

[R] Correlation

2014-07-16 Thread Robert Sherry
Please consider the following R Script: x = c(1,2,3) y = c(1,2,9) cor(x,y) These three lines will produce, as I expected, the correlation between the variables x and y. However, R is going to assume that the probability that x = 1 is the same as the probability that x = 2.

[R] correlation structures in gls models

2014-07-03 Thread Basil Iannone
Dear R users, I have a question regarding accounting for spatioautocorrelation in the residuals of gls models. I would like the error term of my GLS model (in the nlme package) to account/control for spatialautocorrelation among my sample units. So I use a model that looks something along the li

[R] correlation structures in gls

2014-07-02 Thread Basil Iannone
Dear R users, I have a question regarding accounting for spatioautocorrelation in the residuals of gls models. I would like the error term of my GLS model (in the nlme package) to account/control for spatialautocorrelation among my sample units. So I use a model that looks something along the li

Re: [R] correlation given p value and sample size

2014-06-16 Thread peter dalgaard
There's a simple relation t = r / sqrt(1 - r^2) * sqrt(n - 2) r = t / sqrt(n - 2 + t^2) where t has a t distribution on n-2 df. Insert t = +-qt(p/2, n-2). -pd On 16 Jun 2014, at 11:23 , Witold E Wolski wrote: > Hi, > > > Looking for and function which produces the minimum r (pearson > cor

[R] correlation given p value and sample size

2014-06-16 Thread Witold E Wolski
Hi, Looking for and function which produces the minimum r (pearson correlation) so that H0 (r=0) can be rejected, given sample size and p-value? Witold -- Witold Eryk Wolski __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo

Re: [R] correlation with missing values.. different answers

2014-04-14 Thread peter dalgaard
On 14 Apr 2014, at 05:02 , Paul Tanger wrote: > Thanks, I did not realize it was deleting rows! I was afraid to try > "pairwise.complete.obs" because it said something about resulting in a > matrix which is not "positive semi-definite" (and googling that term > just confused me more). It mea

Re: [R] correlation with missing values.. different answers

2014-04-13 Thread Paul Tanger
Thanks, I did not realize it was deleting rows! I was afraid to try "pairwise.complete.obs" because it said something about resulting in a matrix which is not "positive semi-definite" (and googling that term just confused me more). But I ran the dataset through JMP and got the same answers so I t

Re: [R] correlation with missing values.. different answers

2014-04-13 Thread arun
Hi, I think in this case, when you use "na.or.complete", all the NA rows are removed for the full dataset. cor(swM[-1,1:2]) # FrtltyAgrclt  #Frtlty 1.000 0.3920289 #Agrclt 0.3920289 1.000 cor(swM[-1,])[1:2,1:2] #FrtltyAgrclt #Frtlty 1.000 0.3920289 #Agrclt 0

Re: [R] correlation with missing values.. different answers

2014-04-13 Thread Jeff Newmiller
Please post in plain text per the Posting Guide. Read ?cor, particularly the part about "complete.cases". Your two cases have different effective input rows. --- Jeff NewmillerThe . .

[R] correlation with missing values.. different answers

2014-04-13 Thread Paul Tanger
Hi, I can't seem to figure out why this gives me different answers. Probably something obvious, but I thought they would be the same. This is an minimal example from the help page of cor() : > ## swM := "swiss" with 3 "missing"s : > swM <- swiss > colnames(swM) <- abbreviate(colnames(swiss), min

Re: [R] correlation between rows of different data frames

2013-08-28 Thread Bert Gunter
You appear to have no idea what you are doing. I suggest you post on the Bioconductor list, not here, for guidance. Better yet, get help locally from someone who does know what they are doing. Cheers, Bert On Wed, Aug 28, 2013 at 6:36 AM, Robin Mjelle wrote: > Hi, > > I have two data frames with

[R] correlation between rows of different data frames

2013-08-28 Thread Robin Mjelle
Hi, I have two data frames with time serie datamatrix. I want to pick a row X from the first matrix and see if it correlates with row Y in the second matrix. These are gene expression values and I probaly need to do some scaling first, but I wonder if you have any suggestions on how to do the corr

Re: [R] Correlation Loops in time series

2013-08-02 Thread TMiller
Thanks David, that went perfectly fine. Best Tom -- View this message in context: http://r.789695.n4.nabble.com/Correlation-Loops-in-time-series-tp4672732p4672879.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org m

Re: [R] Correlation Loops in time series

2013-07-31 Thread David Carlson
lp-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of TMiller Sent: Wednesday, July 31, 2013 8:16 AM To: r-help@r-project.org Subject: [R] Correlation Loops in time series Hello, I've got the following problem. I have to matrices each containing 200 time series

[R] Correlation Loops in time series

2013-07-31 Thread TMiller
Hello, I've got the following problem. I have to matrices each containing 200 time series. Now I want to calculate the correlation of the first time series of each of the matrices. I use the following command: cor(mts1[,1],mts2[,1], use="complete.obs", method=c("pearson")) cor(mts1[,2],mts2[,2], us

Re: [R] Correlation Loops in time series

2013-07-31 Thread arun
Hi, May be this helps: set.seed(25) mt1<- matrix(sample(c(NA,1:40),20*200,replace=TRUE),ncol=200) set.seed(487) mt2<- matrix(sample(c(NA,1:80),20*200,replace=TRUE),ncol=200) res<- sapply(seq_len(ncol(mt1)),function(i) cor(mt1[,i],mt2[,i],use="complete.obs",method="pearson")) A.K. Hello,

Re: [R] Correlation with p value

2013-02-13 Thread David L Carlson
I Velez'; 'Nico Met' > Cc: 'R help' > Subject: Re: [R] Correlation with p value > > You can use package Hmisc. Assuming your data.frame is called "dta": > > > library(Hmisc) > > dta2 <- do.call(cbind, split(dta[,2], dta$Name)) &

Re: [R] Correlation with p value

2013-02-13 Thread arun
- From: Nico Met To: R help Cc: Sent: Wednesday, February 13, 2013 6:13 AM Subject: [R] Correlation with p value Dear all, I have a data (bellow) and I want to make a correlation test with p-value structure(list(Name = structure(c(3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L,

Re: [R] Correlation with p value

2013-02-13 Thread David L Carlson
org] On Behalf Of Jorge I Velez > Sent: Wednesday, February 13, 2013 5:22 AM > To: Nico Met > Cc: R help > Subject: Re: [R] Correlation with p value > > Nico, > > Check https://stat.ethz.ch/pipermail/r-help/2008-May/161725.html for > some > alternatives. You might ha

Re: [R] Correlation with p value

2013-02-13 Thread Jorge I Velez
Nico, Check https://stat.ethz.ch/pipermail/r-help/2008-May/161725.html for some alternatives. You might have to change the structure of your data, though. HTH, Jorge.- On Wed, Feb 13, 2013 at 10:13 PM, Nico Met <> wrote: > Dear all, > > I have a data (bellow) and I want to make a correlation

[R] Correlation with p value

2013-02-13 Thread Nico Met
Dear all, I have a data (bellow) and I want to make a correlation test with p-value structure(list(Name = structure(c(3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("CTJ", "PKR", "TTK"), class = "factor"), score = c(86.4371428571428, 89.70285714285

[R] correlation coefficient spatially lagged scatterplot

2013-01-01 Thread Florian Sackl
Dear list! I found a 7 year old message with a question very similar to mine: "I am using 'sgeostat' package by Albrecht Gebhardt and I am trying to put a correlation coefficient of some kind on the lagplots. Is there a possiblity to do so?" and i did not find an answer to this question. It woul

Re: [R] Correlation between random effects in the package coxme

2012-09-17 Thread Terry Therneau
On 09/14/2012 05:00 AM, r-help-requ...@r-project.org wrote: Hello, Why the correlation between the random effects is negative? library(coxme) rats1<- coxme(Surv(time, status) ~ (1|litter), rats) random.effects(rats1)[[1]] #one value for each of the 50 litters print(rats1) rats2<- lmekin(time

[R] Correlation between random effects in the package coxme

2012-09-13 Thread Vinicius Santos
Hello, Why the correlation between the random effects is negative? library(coxme) rats1 <- coxme(Surv(time, status) ~ (1|litter), rats) random.effects(rats1)[[1]] #one value for each of the 50 litters print(rats1) rats2 <- lmekin(time ~ (1|litter), rats) fixed.effects(rats2) random.effects(rats2)

Re: [R] Correlation in Rattle

2012-06-11 Thread mlonghi
Same problem here. I have updated rattle from the repository as suggested by Graham, but this, unfortunately, did not solve the issue. (The release date in the 'About Rattle' dialog is 2012-04-22.) Any other ideas? Graham Williams wrote > > It is fixed and 2.6.19 will include the fix. > When

Re: [R] correlation matrix only if enough non-NA values

2012-05-29 Thread Rui Barradas
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 cont

[R] correlation matrix only if enough non-NA values

2012-05-29 Thread jeff6868
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 m

Re: [R] Correlation in Rattle

2012-05-18 Thread Graham Williams
Thanks for assisting here Paul. It turns out there is a bug in this release of Rattle. It is fixed and 2.6.19 will include the fix. In the mean time you can download an updated 2.6.18 from http://www.togaware.com.au/repository/ Regards, Graham On 19 May 2012 01:14, Paul Miller wrote: > Hi Avid

Re: [R] Correlation in Rattle

2012-05-18 Thread Paul Miller
Hi Avideh, Sorry to hear you're still having a problem. Tried usinging this two options on my 64-bit and 32-bit versions of R 2.15.0. Everything works fine. So I've at least been able to determine that there's nothing wrong with Rattle or with the combination of Ratttle and either the 64-bit an

Re: [R] Correlation in Rattle

2012-05-18 Thread Paul Miller
Hi Avideh, I have Rattle installed on the 64-bit version of R 2.15.0 and this seems to work OK. I had a dataset of my own loaded into Rattle when I saw your email. Tried creating the plot using these data but got a warning saying I should limit the number of variables to 40. So I changed to the

Re: [R] Correlation Matrix

2012-05-17 Thread mahdi
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 lis

[R] Correlation in Rattle

2012-05-17 Thread avideh yesharim
Hi, I recently installed Rattle for R 2.15.0 and all the functions work properly except for the Correlation button. After I choose the Correlation radio button in Explore tab, I click Execute, but nothing happens. No results at all. What is it that I am missing? Thank you, Avideh [[al

Re: [R] Correlation Matrix

2012-05-17 Thread Bert Gunter
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, Josh

Re: [R] Correlation Matrix

2012-05-17 Thread Joshua Wiley
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 o

Re: [R] Correlation Matrix

2012-05-17 Thread mahdi
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. __ R-help@r

[R] Correlation Matrix

2012-05-17 Thread mahdi
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. _

Re: [R] Correlation Matrix

2012-05-17 Thread Cren
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: http://r.789695.n4.na

Re: [R] correlation among variables in the same subset

2012-05-16 Thread R. Michael Weylandt
? cor e.g., x <- data.frame(rnorm(5), rnorm(5), rnorm(5), rnorm(5), rnorm(5)) cor(x) Best, Michael On Wed, May 16, 2012 at 6:52 AM, Andrea Sica wrote: > Dear all, > > I have created a subset from my dataset, which contains 6 variables. > I need to make the correlation among all of them, possi

[R] correlation among variables in the same subset

2012-05-16 Thread Andrea Sica
Dear all, I have created a subset from my dataset, which contains 6 variables. I need to make the correlation among all of them, possibly, without making it one by one. Is there any command that can permits me to do it directly for all of them in the same time? Thank you so much in advance. Andr

[R] Correlation Matrix Kendall Tau-b with P value

2012-05-15 Thread Nick Duncan
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

Re: [R] correlation between XY coordinates

2012-05-07 Thread David L Lorenz
: Sarah Goslee To: Christopher Kurby Cc: "r-help@r-project.org" Subject: Re: [R] correlation between XY coordinates Message-ID: <4a58b3c4-c5b6-4c22-a7d3-bd79b8c1f...@gmail.com> Content-Type: text/plain; charset=us-ascii Hi Chris, To get a single value you might need something li

Re: [R] correlation between XY coordinates

2012-05-06 Thread Sarah Goslee
Hi Chris, To get a single value you might need something like a Mantel test, available in both ecodist and vegan. That test is a permutation test of significance of the correlation between two distance matrices. Sarah On May 6, 2012, at 8:06 AM, Christopher Kurby wrote: > Hey Josh (and every

Re: [R] correlation between XY coordinates

2012-05-06 Thread Christopher Kurby
Hey Josh (and everyone), My apologies, let me be more specific. I have two sets of XY coordinates in Cartesian space. I would like to compute a correlation between the two sets. For example, let's say I have two N X 2 matrices, with the first column being the X coordinate, the second column bei

Re: [R] correlation between XY coordinates

2012-05-05 Thread Joshua Wiley
Hi Chris, As Jeff mentioned, it is hard to tell what you want (correlations between sets of coordinates could mean many things it seems like to me), but here is something that perhaps helps: ## some data (usually nice if you provide this rather than us having to make something up) d1 <- cbind(x <

Re: [R] correlation between XY coordinates

2012-05-05 Thread Jeff Newmiller
Isn't that one of the main things base R is used for? Maybe your question is not specific enough. Can you provide some sample data and your best estimate of what the result should look like? The Posting Guide mentioned below could help you elicit more effective answers. --

[R] correlation between XY coordinates

2012-05-05 Thread Christopher Kurby
Hello r world, Does anyone know a function or package that can compute correlations between sets of XY coordinates? Thanks in advance for your help, Chris __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] correlation matrix between data from different files

2012-04-18 Thread jeff6868
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

Re: [R] correlation matrix between data from different files

2012-04-17 Thread jeff6868
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 mo

Re: [R] correlation matrix between data from different files

2012-04-13 Thread Rui Barradas
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

[R] correlation matrix between data from different files

2012-04-12 Thread jeff6868
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 2010,

Re: [R] Correlation between 2 matrices but with subset of variables

2012-03-09 Thread A Ezhil
Dear Peter, Thank you very much. Best regards, Ezhil --- On Fri, 3/9/12, Petr Savicky wrote: > From: Petr Savicky > Subject: Re: [R] Correlation between 2 matrices but with subset of variables > To: r-help@r-project.org > Date: Friday, March 9, 2012, 1:18 PM > On Thu, Mar 08

Re: [R] Correlation between 2 matrices but with subset of variables

2012-03-08 Thread Petr Savicky
On Thu, Mar 08, 2012 at 03:57:06PM -0800, A Ezhil wrote: > Dear All, > I have two matrices A (40 x 732) and B (40 x 1230) and would like to > calculate correlation between them. ?I can use: cor(A,B, method="pearson") to > calculate correlation between all possible pairs. But the issue is that the

Re: [R] Correlation between 2 matrices but with subset of variables

2012-03-08 Thread chuck.01
Example data would be helpful A Ezhil wrote > > Dear All, > I have two matrices A (40 x 732) and B (40 x 1230) and would like to > calculate correlation between them.  I can use: cor(A,B, method="pearson") > to calculate correlation between all possible pairs. But the issue is that > there is

Re: [R] Correlation between 2 matrices but with subset of variables

2012-03-08 Thread A Ezhil
Thanks a lot, Michael.  --- On Fri, 3/9/12, R. Michael Weylandt wrote: From: R. Michael Weylandt Subject: Re: [R] Correlation between 2 matrices but with subset of variables To: "A Ezhil" Cc: r-help@r-project.org Date: Friday, March 9, 2012, 7:59 AM Well, it would be possi

Re: [R] Correlation between 2 matrices but with subset of variables

2012-03-08 Thread R. Michael Weylandt
Well, it would be possible to set something up to select out just the right pairs each time, but on my system the following a <- matrix(rnorm(40 * 732), 40) b <- matrix(rnorm(40 * 1230), 40) system.time(cor(a,b,method = "pearson")) takes about a tenth of a second so any more elective approach wi

[R] Correlation between 2 matrices but with subset of variables

2012-03-08 Thread A Ezhil
Dear All, I have two matrices A (40 x 732) and B (40 x 1230) and would like to calculate correlation between them.  I can use: cor(A,B, method="pearson") to calculate correlation between all possible pairs. But the issue is that there is one-many specific mappings between A and B and I just need

Re: [R] Correlation analysis for an exon array

2012-03-08 Thread R. Michael Weylandt
This question seems more suited to the Bioconductor mailing list: you'll get specialized (and very good) help if you post there. Michael On Thu, Mar 8, 2012 at 6:22 AM, Ekta Jain wrote: > Dear All, > I have an exon array and did not find any differential gene expression > between two samples. I

[R] Correlation analysis for an exon array

2012-03-08 Thread Ekta Jain
Dear All, I have an exon array and did not find any differential gene expression between two samples. I was looking to perform correlation analysis on the same. Can anyone recommend any package that would do this for an affy exon array? Will SAM analysis give me correlated genes? Thanks and reg

Re: [R] Correlation of huge matrix saved as binary file

2012-03-03 Thread Thomas Lumley
On Sat, Mar 3, 2012 at 2:36 PM, Peter Langfelder wrote: > 3. Instead of calculating the correlations one-by-one, calculate them > in small blocks (if you have enough memory and you run a 64-bit R). > With 900M rows, you will only be able to put a 900Mx2 into an R > object, but if you have two suc

Re: [R] Correlation of huge matrix saved as binary file

2012-03-02 Thread Peter Langfelder
I don't think you can speed it up by a whole lot... but you can try a few things, especially if you don't have missing data in the matrix (which you probably don't). The main question is what takes most of the time- the api calls or the cor() call? If it's cor, here's what you can try: 1. Pre-stan

[R] Correlation of huge matrix saved as binary file

2012-03-02 Thread Bryo
Hi, I have a 900,000,000*9,000 matrix where I need to calculate the correlation between all entries along the smaller dimension, thus creating a 9k*9k correlation matrix. This matrix is too big to be uploaded in R, and is saved as a binary file. To access the data in the file I use mmap and some a

[R] Correlation of events over time

2011-12-07 Thread Marie Duarte
Would anyone be able to help me out with the following (or at the least a reference covering the technique (using R) that I require)?; I have a list of events (A, B, C, D), their start date/time and their duration. I also have a time series of a level which is generally maintained at around 90% h

Re: [R] Correlation matrix removing insignificant R values

2011-11-23 Thread R. Michael Weylandt
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[

Re: [R] Correlation matrix removing insignificant R values

2011-11-23 Thread R. Michael Weylandt
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 <- func

  1   2   3   >