correlation

Value Error: object of too small depth for desired array

一笑奈何 提交于 2020-01-24 13:04:25
问题 I want to correlate s1 and s2 variables in my zip_list. However, I have this error: "return multiarray.correlate2(a, v, mode) ValueError: object of too small depth for desired array" Is there anyone who could help me? s1 = [] s2 = [] date = [] for f in files: with open(f) as f: f.next() rows = csv.reader(f) for row in rows: item_list = [] for row_item in row: output_string = map(lambda x: '0' if x=='NULL' else x, row_item.split(",")) item_list.append(output_string) date = item_list[0] s1 =

Value Error: object of too small depth for desired array

人走茶凉 提交于 2020-01-24 13:04:14
问题 I want to correlate s1 and s2 variables in my zip_list. However, I have this error: "return multiarray.correlate2(a, v, mode) ValueError: object of too small depth for desired array" Is there anyone who could help me? s1 = [] s2 = [] date = [] for f in files: with open(f) as f: f.next() rows = csv.reader(f) for row in rows: item_list = [] for row_item in row: output_string = map(lambda x: '0' if x=='NULL' else x, row_item.split(",")) item_list.append(output_string) date = item_list[0] s1 =

Value Error: object of too small depth for desired array

本小妞迷上赌 提交于 2020-01-24 13:03:46
问题 I want to correlate s1 and s2 variables in my zip_list. However, I have this error: "return multiarray.correlate2(a, v, mode) ValueError: object of too small depth for desired array" Is there anyone who could help me? s1 = [] s2 = [] date = [] for f in files: with open(f) as f: f.next() rows = csv.reader(f) for row in rows: item_list = [] for row_item in row: output_string = map(lambda x: '0' if x=='NULL' else x, row_item.split(",")) item_list.append(output_string) date = item_list[0] s1 =

Cross correlation of different time series data values in R

最后都变了- 提交于 2020-01-24 09:36:06
问题 I have a time series data (in day format) of 5 places for 15 days stored as a matrix . The structure of data is meter_daywise<-structure(c(24.4745528484842, 21.5936510486629, 58.9120896540103, 49.4188338105575, 568.791971631185, 27.1682608244523, 23.3482757939878, 74.710966227615, 82.6947717673258, 704.212340152625, 23.7581651139442, 21.154634543401, 64.9680107059625, 420.903181621575, 672.629513512841, 128.22871420984, 601.521395359887, 74.6606087800009, 335.87599588534, 576.451039365565,

Delete weak correlations from network in igraph (vertices and edges)

和自甴很熟 提交于 2020-01-23 09:10:12
问题 I need to plot a network from a correlation matrix. A small subset of my data: Taxon CD1 CD2 Actinomycetaceae;g__Actinomyces 0.072998825 0.031399459 Coriobacteriaceae;g__Atopobium 0.040946468 0.002703265 Corynebacteriaceae;g__Corynebacterium 0.002517201 0.006446247 Micrococcaceae;g__Rothia 0.001174694 0.002703265 Porphyromonadaceae;g__Porphyromonas 0.023326061 0.114368892 Prevotellaceae;g__Prevotella 0.252894781 0.102308172 Flavobacteriaceae;g__Capnocytophaga 0.001174694 0.029320025

Autocorrelation to estimate periodicity with numpy

与世无争的帅哥 提交于 2020-01-22 15:17:05
问题 I have a large set of time series (> 500), I'd like to select only the ones that are periodic. I did a bit of literature research and I found out that I should look for autocorrelation. Using numpy I calculate the autocorrelation as: def autocorr(x): norm = x - np.mean(x) result = np.correlate(norm, norm, mode='full') acorr = result[result.size/2:] acorr /= ( x.var() * np.arange(x.size, 0, -1) ) return acorr This returns a set of coefficients (r?) that when plot should tell me if the time

Pandas: occurrence matrix from one hot encoding from pandas dataframe

半腔热情 提交于 2020-01-21 16:43:47
问题 I have a dataframe, it's in one hot format: dummy_data = {'a': [0,0,1,0],'b': [1,1,1,0], 'c': [0,1,0,1],'d': [1,1,1,0]} data = pd.DataFrame(dummy_data) Output: a b c d 0 0 1 0 1 1 0 1 1 1 2 1 1 0 1 3 0 0 1 0 I am trying to get the occurrence matrix from dataframe, but if I have columns name in list instead of one hot like this: raw = [['b','d'],['b','c','d'],['a','b','d'],['c']] unique_categories = ['a','b','c','d'] Then I am able to find the occurrence matrix like this: df = pd.DataFrame(raw

How to visualize correlation matrix as a schemaball in Matlab

雨燕双飞 提交于 2020-01-19 04:18:05
问题 I have 42 variables and I have calculated the correlation matrix for them in Matlab. Now I would like to visualize it with a schemaball. Does anyone have any suggestions / experiences how this could be done in Matlab? The following pictures will explain my point better: In the pictures each parabola between variables would mean the strength of correlation between them. The thicker the line is, the more correlation. I prefer the style of picture 1 more than the style in picture 2 where I have

Looping correlation tests on same variables across more than two dataframes

拥有回忆 提交于 2020-01-17 03:17:21
问题 Consider these three dataframes: df1 <- data.frame(a = runif(10,1,10), b = runif(10,1,10), c = runif(10,1,10)) df2 <- data.frame(a = runif(10,1,10), b = runif(10,1,10), c = runif(10,1,10)) df3 <- data.frame(a = runif(10,1,10), b = runif(10,1,10), c = runif(10,1,10)) I want to do a cor.test between column a against column a , b against b and c against c in all dfs – I can do it between each pair using and modifying code below but I want loop between all three dataframes in one go: for (i in 1

Matlab: Confusion related to Correlation operation for lags

可紊 提交于 2020-01-16 20:04:40
问题 I have a time series model y(t)= h^T y(t-1) + n(t) where n(t) is a white Gaussian noise that excites and drives the process. y is the output of a linear regression model for t = 1,2,... denoting the number of data points. Question: If the Correlation matrix is Ryy = E[y(t)*y(t)^T], then is it possible to compute Correlation of the lagged random variables such as [E[y(t-1)*y(t-1)']] In general, these operators and expressions are also found in: Slide2 mentions the Autocorrelation matrix. In