Re: [R] Creating a correlation Matrix
Have you considered cor? The command 'help.search(correlation)' suggests among other functions var(stats), the documentation for which also includes cor. If this is not adequate, PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html . It may help you get more useful replies in the future. spencer graves Jessica Higgs wrote: Hi all: I have a question on how to go about creating a correlation matrix. I have a huge amount of data21 variables for 3471 times. I want to see how each of the variables correlate to each other. Any help would be appreciated, including which package and which functions I should use to do this. Thanks, Jessica Higgs Masters Student Department of Meteorology Penn State University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Creating a correlation Matrix
From the help for cor (from the stats package): If x and y are matrices then the covariances (or correlations) between the columns of x and the columns of y are computed. So if you make a matrix with each column corresponding to one of your variables, you can get what you're after. For future reference, help.search(correlation) turns up the proper page as the first suggestion. Hope this helps, Matt Wiener -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jessica Higgs Sent: Monday, February 07, 2005 10:58 AM To: R-help@stat.math.ethz.ch Subject: [R] Creating a correlation Matrix Hi all: I have a question on how to go about creating a correlation matrix. I have a huge amount of data21 variables for 3471 times. I want to see how each of the variables correlate to each other. Any help would be appreciated, including which package and which functions I should use to do this. Thanks, Jessica Higgs Masters Student Department of Meteorology Penn State University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Creating a correlation Matrix
Le 07.02.2005 16:58, Jessica Higgs a écrit : Hi all: I have a question on how to go about creating a correlation matrix. I have a huge amount of data21 variables for 3471 times. I want to see how each of the variables correlate to each other. Any help would be appreciated, including which package and which functions I should use to do this. Hello, that is not that huge and what is wrong with ?cor A - matrix(rnorm(21*3471),ncol=21) #you should replace A by your data matcor - cor(A) #that is your correlation matrix image(matcor) # and how to watch it heatmap(matcor) # an other way to watch it Hope this helps. Romain -- Romain FRANCOIS : [EMAIL PROTECTED] page web : http://addictedtor.free.fr/ (en construction) 06 18 39 14 69 / 01 46 80 65 60 ___ Etudiant en 3eme année Institut de Statistique de l'Université de Paris (ISUP) Filière Industrie et Services http://www.isup.cicrp.jussieu.fr/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Creating a correlation Matrix
I've tried using cor() by the following sequence: C - cor(x, y = NULL, use = all.obs, method = c(pearson)) where x is my matrix of 21 columns and 3471 rows. and I get this error: Error in cor(x, y = NULL, use = all.obs, method = c(pearson)) : missing observations in cov/cor any suggestions? At 08:32 AM 2/7/2005 -0800, Spencer Graves wrote: Have you considered cor? The command 'help.search(correlation)' suggests among other functions var(stats), the documentation for which also includes cor. If this is not adequate, PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html . It may help you get more useful replies in the future. spencer graves Jessica Higgs wrote: Hi all: I have a question on how to go about creating a correlation matrix. I have a huge amount of data21 variables for 3471 times. I want to see how each of the variables correlate to each other. Any help would be appreciated, including which package and which functions I should use to do this. Thanks, Jessica Higgs Masters Student Department of Meteorology Penn State University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Creating a correlation Matrix
Jessica Higgs wrote: I've tried using cor() by the following sequence: C - cor(x, y = NULL, use = all.obs, method = c(pearson)) where x is my matrix of 21 columns and 3471 rows. and I get this error: Error in cor(x, y = NULL, use = all.obs, method = c(pearson)) : missing observations in cov/cor any suggestions? Reading ?cor would have given you a solution: Quoting from ?cor If 'use' is 'all.obs', then the presence of missing observations will produce an error. If 'use' is 'complete.obs' then missing values are handled by casewise deletion. Finally, if 'use' has the value 'pairwise.complete.obs' then the correlation between each pair of variables is computed using all complete pairs of observations on those variables. This can result in covariance or correlation matrices which are not positive semidefinite. You have missing values in your data and with your usage of cor and argument use = all.obs precludes this. Choose another value for use, noting the advice in the help pages for cor. G At 08:32 AM 2/7/2005 -0800, Spencer Graves wrote: Have you considered cor? The command 'help.search(correlation)' suggests among other functions var(stats), the documentation for which also includes cor. If this is not adequate, PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html . It may help you get more useful replies in the future. spencer graves Jessica Higgs wrote: Hi all: I have a question on how to go about creating a correlation matrix. I have a huge amount of data21 variables for 3471 times. I want to see how each of the variables correlate to each other. Any help would be appreciated, including which package and which functions I should use to do this. Thanks, Jessica Higgs Masters Student Department of Meteorology Penn State University -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [T] +44 (0)20 7679 5522 ENSIS Research Fellow [F] +44 (0)20 7679 7565 ENSIS Ltd. ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk UCL Department of Geography [W] http://www.ucl.ac.uk/~ucfagls/cv/ 26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/ London. WC1H 0AP. %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Creating a correlation Matrix
Le 07.02.2005 18:53, Jessica Higgs a écrit : I've tried using cor() by the following sequence: C - cor(x, y = NULL, use = all.obs, method = c(pearson)) In ?cor you find that : If 'use' is 'all.obs', then the presence of missing observations will produce an error. try use=complete instead. Romain. where x is my matrix of 21 columns and 3471 rows. and I get this error: Error in cor(x, y = NULL, use = all.obs, method = c(pearson)) : missing observations in cov/cor any suggestions? At 08:32 AM 2/7/2005 -0800, Spencer Graves wrote: Have you considered cor? The command 'help.search(correlation)' suggests among other functions var(stats), the documentation for which also includes cor. If this is not adequate, PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html . It may help you get more useful replies in the future. spencer graves Jessica Higgs wrote: Hi all: I have a question on how to go about creating a correlation matrix. I have a huge amount of data21 variables for 3471 times. I want to see how each of the variables correlate to each other. Any help would be appreciated, including which package and which functions I should use to do this. Thanks, Jessica Higgs Masters Student Department of Meteorology Penn State University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Romain FRANCOIS : [EMAIL PROTECTED] page web : http://addictedtor.free.fr/ (en construction) 06 18 39 14 69 / 01 46 80 65 60 ___ Etudiant en 3eme année Institut de Statistique de l'Université de Paris (ISUP) Filière Industrie et Services http://www.isup.cicrp.jussieu.fr/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Creating a correlation Matrix
It looks like you have missing observations. With the use argument, you can specify complete observations or pairwise-complete observations. Hope this helps, Matt Wiener -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jessica Higgs Sent: Monday, February 07, 2005 12:54 PM To: Spencer Graves; R-help@stat.math.ethz.ch Subject: Re: [R] Creating a correlation Matrix I've tried using cor() by the following sequence: C - cor(x, y = NULL, use = all.obs, method = c(pearson)) where x is my matrix of 21 columns and 3471 rows. and I get this error: Error in cor(x, y = NULL, use = all.obs, method = c(pearson)) : missing observations in cov/cor any suggestions? At 08:32 AM 2/7/2005 -0800, Spencer Graves wrote: Have you considered cor? The command 'help.search(correlation)' suggests among other functions var(stats), the documentation for which also includes cor. If this is not adequate, PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html . It may help you get more useful replies in the future. spencer graves Jessica Higgs wrote: Hi all: I have a question on how to go about creating a correlation matrix. I have a huge amount of data21 variables for 3471 times. I want to see how each of the variables correlate to each other. Any help would be appreciated, including which package and which functions I should use to do this. Thanks, Jessica Higgs Masters Student Department of Meteorology Penn State University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html