correlation

Phase correlation

不想你离开。 提交于 2019-11-29 04:53:20
How can rotation angle be determined by phase correlation(using fft) of 2 images? The algorithm given in http://en.wikipedia.org/wiki/Phase_correlation returns linear shift, not angular. It also mentions images have to be converted to log-polar coordinates to compute rotation. How is this conversion achieved in python? And post conversion do the same steps of the algorithm hold? S.Amar Nath Log polar transformation is actually rotation and scale invariant.. Rotation corresponds to shift in y axis and scaling corresponds to shift in x axis in log polar transformation So simple steps are as

Encountered invalid value when I use pearsonr

早过忘川 提交于 2019-11-29 03:56:14
Maybe I made a mistake. If so, I am sorry to ask this. I want to calculate Pearson's correlation coefficent by using scipy's pearsonr function. from scipy.stats.stats import pearsonr X = [4, 4, 4, 4, 4, 4] Y = [4, 5, 5, 4, 4, 4] pearsonr(X, Y) I get an error below RuntimeWarning: invalid value encountered in double_scalars ### The reason why I get an error is E[X] = 4 (Excepted Value of X is 4) I look at the code of pearsonr function in scpy.stats.stats.py. Some part of the pearsonr function is as follows. mx = x.mean() # which is 4 my = y.mean() # not necessary xm, ym = x-mx, y-my # xm = [0 0

kissfft scaling

删除回忆录丶 提交于 2019-11-29 03:12:36
问题 I am looking to compute a fast correlation using FFTs and the kissfft library, and scaling needs to be precise. What scaling is necessary (forward and backwards) and what value do I use to scale my data? 回答1: The 3 most common FFT scaling factors are: 1.0 forward FFT, 1.0/N inverse FFT 1.0/N forward FFT, 1.0 inverse FFT 1.0/sqrt(N) in both directions, FFT & IFFT Given any possible ambiguity in the documentation, and for whatever scaling the user expects to be "correct" for their purposes,

numpy corrcoef - compute correlation matrix while ignoring missing data

ε祈祈猫儿з 提交于 2019-11-29 02:29:20
问题 I am trying to compute a correlation matrix of several values. These values include some 'nan' values. I'm using numpy.corrcoef. For element(i,j) of the output correlation matrix I'd like to have the correlation calculated using all values that exist for both variable i and variable j. This is what I have now: In[20]: df_counties = pd.read_sql("SELECT Median_Age, Rpercent_2008, overall_LS, population_density FROM countyVotingSM2", db_eng) In[21]: np.corrcoef(df_counties, rowvar = False) Out

How to change font size of the correlation coefficient in corrplot?

只愿长相守 提交于 2019-11-28 23:24:07
I am plotting correlation plot with corrplot. I want to plot also the correlation coefficients: require(corrplot) test <- matrix(data = rnorm(400), nrow=20, ncol=20) corrplot(cor(test), method = "color", addCoef.col="grey", order = "AOE") But they are too big in the plot: Is there any way to make the font of the coefficent smaller? I've been looking at ?corrplot but there are only parameters to change the legend and axis font sizes ( cl.cex and tl.cex ). pch.cex doesn't work either. It is far from the answer, it is kind of a dirty hack, but this works (thanks user20650 for the idea): cex

How to modify this Correlation Matrix plot?

匆匆过客 提交于 2019-11-28 19:55:20
I have the following codes to display a correlation matrix, panel.cor <- function(x, y, digits=2, prefix="", cex.cor) { usr <- par("usr"); on.exit(par(usr)) par(usr = c(0, 1, 0, 1)) r <- abs(cor(x, y)) txt <- format(c(r, 0.123456789), digits=digits)[1] txt <- paste(prefix, txt, sep="") if(missing(cex.cor)) cex <- 0.8/strwidth(txt) test <- cor.test(x,y) # borrowed from printCoefmat Signif <- symnum(test$p.value, corr = FALSE, na = FALSE, cutpoints = c(0, 0.001, 0.01, 0.05, 0.1, 1), symbols = c("***", "**", "*", ".", " ")) text(0.5, 0.5, txt, cex = cex * r) text(.8, .8, Signif, cex=cex, col=2) }

Significance level added to matrix correlation heatmap using ggplot2

点点圈 提交于 2019-11-28 15:33:54
问题 I wonder how one can add another layer of important and needed complexity to a matrix correlation heatmap like for example the p value after the manner of the significance level stars in addition to the R2 value (-1 to 1)? It was NOT INTENDED in this question to put significance level stars OR the p values as text on each square of the matrix BUT rather to show this in a graphical out-of-the-box representation of significance level on each square of the matrix. I think only those who enjoy

p-values of correlation coefficients

瘦欲@ 提交于 2019-11-28 12:44:13
I am using R and have a question on correlations. A<-data.frame(A1=c(1,2,3,4,5),B1=c(6,7,8,9,10),C1=c(11,12,13,14,15 )) B<-data.frame(A2=c(6,7,7,10,11),B2=c(2,1,3,8,11),C2=c(1,5,16,7,8)) cor(A,B) # A2 B2 C2 # A1 0.9481224 0.9190183 0.459588 # B1 0.9481224 0.9190183 0.459588 # C1 0.9481224 0.9190183 0.459588 I wanted to obtain the p-value for each of the correlation coefficients in the matrix. Is this possible? I tried using rcorr function from Hmisc package but obtain only a single p-value and not for each correlation. A <- as.vector(t(A)) B <- as.vector(t(B)) rcorr(A, B) x y x 1.00 0.13 y 0

In R, how do I find the optimal variable to maximize or minimize correlation between several datasets

谁说我不能喝 提交于 2019-11-28 11:46:39
I am able to do this easily in Excel, but my dataset has gotten too large. In excel, I would use solver. Column A,B,C,D = random numbers Column E = random number (which I want to maximize the correlation to) Column F = A*x+B*y+C*z+D*j where x,y,z,j are coefficients resulted from solver In a separate cell, I would have correl(E,F) In solver, I would set the objective of correl(C,D) to max, by changing variables x,y and setting certain constraints: 1. A,B,C,D have to be between 0 and 1 2. A+B+C+D = 1 How can I do this in R? Thanks for the help. Since most optimization routines work best with no

Correlation Corrplot Configuration

ぐ巨炮叔叔 提交于 2019-11-28 08:40:51
I am newbie in R scripts :-) I need build a correlation matrix and I´am trying to configurate some parameters to adapt the graph. I am using the corrplot package. I Built a corrplot matrix this way: corrplot(cor(d1[,2:14], d1[,2:14]), method=c("color"), bg = "white", addgrid.col = "gray50", tl.cex=1, type="lower", tl.col = "black", col = colorRampPalette(c("red","white","blue"))(100)) I need show the values of correlation in the lower matrix inside the color matrix that I built. How i can do that? Is it possible exclude the main diagonal from the lower matrix? In this diagonl always we have