# Tagged Questions

A measure of the degree of linear association among a pair of variables.

13k views

### What is the difference between linear regression on y with x and x with y?

The Pearson correlation coefficient of x and y is the same, whether you compute pearson(x, y) or pearson(y, x). This suggests that doing a linear regression of y given x or x given y should be the ...
36k views

### Pearson's or Spearman's correlation with non-normal data

I get this question frequently enough in my statistics consulting work, that I thought I'd post it here. I have an answer, which is posted below, but I was keen to hear what others have to say. ...
2k views

### How to generate correlated random numbers (given means, variances and degree of correlation)?

I'm sorry if this seems a bit too basic, but I guess I'm just looking to confirm understanding here. I get the sense I'd have to do this in two steps, and I've started trying to grok correlation ...
4k views

### Look and you shall find (a correlation)

I have a several hundreds of measurements. Now I am considering utilizing some kind of software to correlate every measure with every measure. This means that there are hundreds of correlations. Among ...
3k views

### If A and B are correlated with C, why are A and B not necessarily correlated?

I know empirically that is the case. I have just developed models that run into this conundrum. I also suspect it is not necessarily a yes/no answer. I mean by that if both A and B are correlated ...
11k views

### What is covariance in plain language?

What is covariance in plain language and how is it linked to the terms dependence, correlation and variance-covariance structure with respect to repeated-measures designs?
4k views

### X and Y are not correlated, but X is significant predictor of Y in multiple regression. What does it mean?

X and Y are not correlated (-.01); however, when I place X in a multiple regression predicting Y, alongside three (A, B, C) other (related) variables, X and two other variables (A, B) are significant ...
8k views

### Under what conditions does correlation imply causation?

We all know the mantra "correlation does not imply causation" which is drummed into all first year statistics students. There are some nice examples here to illustrate the idea. But sometimes ...
100k views

### How to choose between Pearson and Spearman correlation?

How do I know when to choose between Spearman's $\rho$ and Pearson's $r$? My variable includes satisfaction and the scores were interpreted using the sum of the scores. However, these scores could ...
2k views

### Should one remove highly correlated variables before doing PCA?

I'm reading a paper where author discards several variables due to high correlation to other variables before doing PCA. The total number of variables is around 20. Does this give any benefits? It ...
3k views

### Averaging correlation values

Let's say I test how variable Y depends on variable X under different experimental conditions and obtain the following graph: ...
329 views

### How to report general precision in estimating correlations within a context of justifying sample size?

I have a study with 130 participants where most of my analyses involve examining the relative size of correlations between various psychological variables. I'm trying to comply with recommendations ...
25k views

### What's the difference between correlation and simple linear regression?

In particular, I am referring to the Pearson product-moment correlation coefficient.
35k views

### Examples for teaching: Correlation does not mean causation

There is an old saying: "Correlation does not mean causation". When I teach, I tend to use the following standard examples to illustrate this point: number of storks and birth rate in Denmark; ...
7k views

### Coefficient of Determination ($r^2$): I have never fully grasped the interpretation

I want to fully grasp the notion of $r^2$ describing the amount of variation between variables. Every web explanation is a bit mechanical and obtuse. I want to "get" the concept, not just mechanically ...
2k views

### How to correlate two time series with gaps and different time bases?

I asked this question over on StackOverflow, and was recommended to ask it here. I have two time series of 3D accelerometer data that have different time bases (clocks started at different times, ...
684 views

### How to define a distribution such that draws from it correlate with a draw from another pre-specified distribution?

How do I define the distribution of a random variable $Y$ such that a draw from $Y$ has correlation $\rho$ with $x_1$, where $x_1$ is a single draw from a distribution with cumulative distribution ...
12k views

### Kendall Tau or Spearman's rho?

In which cases should one prefer the one over the other? I found someone who claims an advantage for Kendall, for pedagogical reasons, are there other reasons?
444 views

### First quick glance at a dataset

Please pardon my ignorance, but... I keep finding myself in a situation, where I'm faced with a bunch of new data I managed to find. This data usually looks something like this: ...
786 views

### Least angle regression keeps the correlations monotonically decreasing and tied?

I'm trying to solve a problem for least angle regression (LAR). This is a problem 3.23 on page 97 of Hastie et al., Elements of Statistical Learning, 2nd. ed. (5th printing). Consider a regression ...
2k views

### Manually calculated $R^2$ doesn't match up with randomForest() $R^2$ for testing new data

I know this is a fairly specific R question, but I may be thinking about proportion variance explained, $R^2$, incorrectly. Here goes. I'm trying to use the ...
2k views

### Is there a simple way of detecting outliers?

I am wondering if there is a simple way of detecting outliers. For one of my projects, which was basically a correlation between the number of times respondents participate in physical activity in a ...
7k views

### How to compute correlation between/within groups of variables?

I have a matrix of 1000 observations and 50 variables each measured on a 5-point scale. These variables are organized into groups, but there aren't an equal number of variables in each group. I'd ...
333 views

### What correlation makes a matrix singular and what are implications of singularity or near-singularity?

I am doing some calculations on different matrices (mainly in logistic regression) and I commonly get the error "Matrix is singular", where I have to go back and remove the correlated variables. My ...
2k views

### Working with correlation coefficients

I have three Pearson correlation coefficients (.8978, .5676 and .7865) for three age groups (i.e. 21 to 30 years, 31 to 40 years and 41 to 50 years) whose behaviour I am studying in regard to their ...
2k views

### How do I compare correlation coefficients of the same variables across different groups?

I am testing the correlation between Variable A and Variable B by gender and marital status. So I have the coefficients for males and females and single, married and other. I want to compare the ...
1k views

### Computing correlation (and the significance of said correlation) between a pair of time series

I have two time series S, and T. they have the same frequency and the same length. I would like to calculate (using R), the correlation between this pair (i.e. S and T), and also be able to calculate ...
820 views

### What are some techniques for sampling two correlated random variables?

What are some techniques for sampling two correlated random variables: if their probability distributions are parameterized (e.g., log-normal) if they have non-parametric distributions. The data ...
821 views

### Unbiased estimation of covariance matrix for multiply censored data

Chemical analyses of environmental samples are often censored below at reporting limits or various detection/quantitation limits. The latter can vary, usually in proportion to the values of other ...
5k views

### What is compound symmetry in plain english?

I recently realized that a mixed-model with only subject as a random factor and the other factors as fixed factors is equivalent to an ANOVA when setting the correlational structure of the mixed model ...
281 views

### Attainable correlations for lognormal random variables

Consider the lognormal random variables $X_1$ and $X_2$ with $\log(X_1)\sim \mathcal{N}(0,1)$, and $\log(X_2)\sim \mathcal{N}(0,\sigma^2)$. I'm trying to calculate $\rho_{\max}$ and $\rho_{\min}$ for ...
1k views

### Correlating volume timeseries

Consider the following graph: The red line (left axis) describes the trading volume of a certain stock. The blue line (right axis) describes the twitter message volume for that stock. For instance, ...
434 views

### Basis of Pearson correlation coefficient

Pearson correlation coefficient is calculated using the formula $r = \frac{cov(X,Y)}{\sqrt{var(X)} \sqrt{var(Y)}}$. How does this formula contain the information that the two variates $X$ and $Y$ are ...
149 views

### Correlation between vegetation and erosion

I am wanting to find the correlation between two variables: a categorical vegetation variable (with categories 1-4) and a continuous variable of erosion (with values anywhere between 0.2 and 9). I ...
1k views

### Correlation analysis and correcting $p$-values for multiple testing

I am investigating the effect of a drug on EEG and cognition in epilepsy patients. We have done EEG and neuropsychological (NP) tests twice, before and after medical treatment. Some of parameters in ...
7k views

### Threshold for correlation coefficient to indicate statistical significance of a correlation in a correlation matrix

I have computed a correlation matrix of a data set which contains 455 data points, each data point containing 14 characteristics. So the dimension of the correlation matrix is 14 x 14. I was ...
1k views

### How do I weigh several variables at two levels to create an overall composite variable score?

Context I am trying to find the correlation between two latent variables. Let's call them A and B. A has two dimensions. Let's call them Dimension 1 and 2. B also has two dimensions. Let's call ...
690 views

### How to determine the number of clusters when using correlation as the distance?

How does using 1 - correlation as the distance influence the determination of the number of clusters when doing kmeans? Is it still valid to use the classical indices (Dunn, Davies-Bouldin...)?
366 views

### Magnitude of a relationship

If I run Pearson correlation between Variable A (buyer/nonbuyer of ice-cream) and Variable B (buyer/nonbuyer of yoghurt) and have: Ho as "There is no relationship between...." Ha as "There is a ...
2k views

### How to efficiently generate Positive Semi Definite correlation matrices?

I would like to be able to efficiently generate PSD (positive semi definite) correlation matrices. My method slows down dramatically as I increase the size of matrices to be generated. Could you ...
2k views

### Quickly evaluate (visually) correlations between ordered categorical data in R?

I'm looking for correlations between the answers to different questions in a survey ("umm, let's see if answers to question 11 correlate with those of question 78"). All answers are categorical (most ...
3k views

### Does causation imply correlation?

Correlation does not imply causation, as there could be many explanations for the correlation. But does causation imply correlation? Intuitively, I would think that the presence of causation means ...
1k views

### Can the MIC algorithm for detecting non-linear correlations be explained intuitively ?

More recently, I read two articles. First one is about the history of the correlation and second is about the new method called Maximal Information Coefficient (MIC). I need your help regarding to ...
3k views

### What is the major difference between correlation and mutual information?

my question particularly applies to network reconstruction
2k views

### R: compute correlation by group

In R, I have a data frame comprising a class label C (a factor) and two measurements, M1 and M2. How do I compute the correlation between M1 and M2 within each class? Ideally, I'd get back a data ...
2k views

### Does correlation assume stationarity of data?

Inter-market analysis is a method of modeling market behavior by means of finding relationships between different markets. Often times, a correlation is computed between two markets, say S&P 500 ...
505 views

### Generate sets of values with high correlation coefficient

Apology if this is too simple. I couldn't get the more advanced r-help group to respond. I am planning to characterize workloads by measuring the correlation coefficient of two sets of real values ...
10k views

### How to test the autocorrelation of the residuals?

I have a matrix with two columns that have many prices (750). In the image below I plotted the residuals of the follow linear regression: ...
Suppose you have an $n$-vector $X$. For a fixed real number, $r$ between $-1$ and $1$, can one generate a random permutation of the integers $1,2,\ldots,n$, call it $i_1,i_2,\ldots,i_n$ such that the ...