correlation

Looping correlation tests within nested lists on same variables across more than two dataframes

爷,独闯天下 提交于 2020-01-07 04:11:25
问题 Consider these three dataframes in a nested list: 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)) dflist1 <- list(df1,df2,df3) dflist2 <- list(df1,df2,df3) nest_list <- list(dflist1, dflist2) I want to do a 'cor.test' between column 'a' against column 'a', 'b' against 'b' and 'c' against 'c' in all 'dfs' for

Error with CORR function in Pandas

半城伤御伤魂 提交于 2020-01-06 23:49:28
问题 I had a CSV file of 2 stock prices data which I did some native python coding to create 2 single lists of prices (in Decimals) of 2 stock counters. I then converted them to 2 pandas dataframe, used the .pct_change() function then applied the a.corr(b) function in an attempt to get the correlation. This is the error msg that I got. Anyone can advise on the issue here? Traceback (most recent call last): File "D:/python/NQ_MSFT regression.py", line 71, in <module> print(nqpct.corr(mspct)) File

How to save plot generated by pairs.panels from R's psych library in Jupyter

我怕爱的太早我们不能终老 提交于 2020-01-06 19:31:42
问题 I'm using R's psych library and I'm plotting correlation pairs on a Jupyter notebook using its pairs.panels function. I tried using ggplot's ggsave function to save the plot but it wouldn't work. The error says: Error in ggsave(filename = "correlation-pairs.png", : plot should be a ggplot2 plot Is there a way to save the output of pairs.panels ? 来源: https://stackoverflow.com/questions/33819676/how-to-save-plot-generated-by-pairs-panels-from-rs-psych-library-in-jupyter

Generating random correlation matrix with given average correlation

半世苍凉 提交于 2020-01-06 14:46:46
问题 I would like to generate a random correlation matrix in R of 1000*1000 where the average correlation (excluding diagonal) is 0.3. I looked at genPositiveDefMat from library clusterGeneration but I couldn't figure out how to specify a given correlation. 回答1: A boring example of such a matrix would be C = (1-m)*I + m*U*U' where I is the identity matrix, U a vector of all ones and m = 0.3. C is positive definite and the average (indeed every) off-diagonal element is m. So we could try generating

How can I get confidence intervals for a one-tailed, bootstrapped Pearson correlation in R?

半腔热情 提交于 2020-01-06 09:54:07
问题 I want to calculate 95% bootstrap confidence intervals for a one-tailed, nonparametric bootstrapped Pearson correlation test in R . However, boot.ci only gives two-tailed CIs. How can I calculate one-tailed bootstrap CIs? Here's my code for a one-tailed, bootstrapped Pearson correlation test using cor.test . (It includes boot.ci at the end, which returns two-tailed CI, not desired one-tailed CI. The output is included as comments ( # ) for comparison.) # Load boot package library(boot) # Make

Reducing correlation of datasets with NA

為{幸葍}努か 提交于 2020-01-06 05:01:06
问题 Consider the sample data below: a=c(NA,1,NA) b=c(1,2,4) c=c(0,1,0) d=c(1,2,4) df=data.frame(a,b,c,d) Objective to find correlation between 2 columns where NA should reduce the correlation. NA means that an event did not take place. Is there a way to use NA in the correlation such that it pulls down the value of the correlation? > cor(df$a, df$b) [1] NA Or should I be looking at some other mathematical function? 回答1: Is there a way to use NA in the correlation such that it pulls down the value

Phase correlation for template matching

眉间皱痕 提交于 2020-01-05 09:34:57
问题 I am trying to implement template matching using phase correlation. I have already done it in the spatial domain. You can see here My template image is imagePart and the image in which I am finding it is imageBig . Now I am trying it using DFT to increase speed. I am following these steps as suggested by Cris Luengo Pad the template (floating image) to the size of the other image (with zeros). Compute the FFT of both. Flip the sign of the imaginary component of one of the results (complex

Phase correlation for template matching

﹥>﹥吖頭↗ 提交于 2020-01-05 09:34:05
问题 I am trying to implement template matching using phase correlation. I have already done it in the spatial domain. You can see here My template image is imagePart and the image in which I am finding it is imageBig . Now I am trying it using DFT to increase speed. I am following these steps as suggested by Cris Luengo Pad the template (floating image) to the size of the other image (with zeros). Compute the FFT of both. Flip the sign of the imaginary component of one of the results (complex

Cas Ticket Issue in Jmeter

回眸只為那壹抹淺笑 提交于 2020-01-04 07:59:48
问题 I have a web application which uses CAS Ticket for user authentication purpose which is different for every login. I recorded the script in JMeter. Also I correlated the pages by filling up the Regular Expression Extractor as follows: Recorded script has url: https://foo.com/j_spring_cas_security_check?ticket=ST-3101-QDTyjbbHoOHvgPMdRBIg-cas . After applying all above I ran the script but got status fail displaying https://foo.com/j_spring_cas_security_check?ticket=Ticket_Not_Found . It would

correlation by row, within data frame

我与影子孤独终老i 提交于 2020-01-04 05:30:07
问题 I am attempting to calculate the correlation between all the rows of a large data frame, and so far have come up with a simple for-loop that works. For example: name <- c("a", "b", "c", "d") col1 <- c(43.78, 43.84, 37.92, 31.72) col2 <- c(43.80, 43.40, 37.64, 31.62) col3 <- c(43.14, 42.85, 37.54, 31.74) df <- data.frame(name, col1, col2, col3) cor.df <- data.frame(name1=NA, name2=NA,correl=NA) for(i in 1: (nrow(df) - 1)) { for(j in (i+1): nrow(df) ) { v1 <- as.numeric( df[i, 2:ncol(df)] ) v2