html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue
https://github.com/pydata/xarray/issues/1115#issuecomment-417816234,https://api.github.com/repos/pydata/xarray/issues/1115,417816234,MDEyOklzc3VlQ29tbWVudDQxNzgxNjIzNA==,1217238,2018-08-31T23:55:06Z,2018-08-31T23:55:06Z,MEMBER,"I tend to view the second case as a generalization of the first case. I would also hesitate to implement the `n x m` array -> `m x m` correlation matrix version because xarray doesn't handle repeated dimensions well.
I think the basic implementation of this looks quite similar to what I wrote here for calculating the Pearson correlation as a NumPy gufunc:
http://xarray.pydata.org/en/stable/dask.html#automatic-parallelization
The main difference is that we might naturally want to support summing over multiple dimensions at once via the `dim` argument, e.g., something like:
```python
# untested!
def covariance(x, y, dim=None):
return xarray.dot(x - x.mean(dim), y - y.mean(dim), dim=dim)
def corrrelation(x, y, dim=None):
# dim should default to the intersection of x.dims and y.dims
return covariance(x, y, dim) / (x.std(dim) * y.std(dim))
```
If you want to achieve the equivalent of `np.corr` on an array with dimensions `('n', 'm')` with this, you just write something like `correlation(x, x.rename({'m': 'm2'}), dim='n')`.","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,188996339
https://github.com/pydata/xarray/issues/1115#issuecomment-260382091,https://api.github.com/repos/pydata/xarray/issues/1115,260382091,MDEyOklzc3VlQ29tbWVudDI2MDM4MjA5MQ==,1217238,2016-11-14T16:20:14Z,2016-11-14T16:20:14Z,MEMBER,"That said, correlation coefficients are a pretty fundamental operation for working with data. I could see implementing a basic `corr` in xarray and referring to a separate signal processing package for more options in the docstring.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,188996339
https://github.com/pydata/xarray/issues/1115#issuecomment-260219462,https://api.github.com/repos/pydata/xarray/issues/1115,260219462,MDEyOklzc3VlQ29tbWVudDI2MDIxOTQ2Mg==,1217238,2016-11-13T22:57:02Z,2016-11-13T22:57:02Z,MEMBER,"The first step here is to find a library that implements the desired functionality on pure NumPy arrays, ideally in a vectorized fashion. Then it should be pretty straightforward to wrap in xarray.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,188996339