correlation

xcorr (for autocorrelation) with NaN values

瘦欲@ 提交于 2019-12-11 05:46:15
问题 I'd like to autocorrelate some data but it has some missing values, is there a quick way to do this in matlab? xcorr returns an array of NaN if any of the input is NaN. e.g. data = [1 2 3 4 NaN 2 3 4 1 2 3 4]; xc = xcorr(data, 'biased'); 回答1: With some insight from Nzbuu, the following works: data = [1 2 3 4 NaN 2 3 4 5]; scaled = (data - nanmean(data)) / nanstd(data); scaled(isnan(data)) = 0; corr = xcorr(scaled); It is necessary to insert zeros after scaling the data, not before, as

Success of template-matching with opencv

℡╲_俬逩灬. 提交于 2019-12-11 05:24:17
问题 How do I measure success of the opencv template-matching algorithm ? I understand that the minmaxLoc function can be used to find the location of the best match. But does it also give an indication on how good the match actually was ? (If yes, how would you find out ?) Is there an even more appropriate function to measure the correlation between the found match (green rectangle) and the original template ? For example, what if the template-image is slightly rotated or translated compared to

Is Spearman's cor.test in R tie corrected or not?

▼魔方 西西 提交于 2019-12-11 02:25:46
问题 I was wondering if the cor.test function in R to compute Spearman's rho is tie-corrected or not. I couldn't find a straight answer in the official R documentation. An example of tie corrected Spearman is found in: Cureton, Edward E. The average spearman rank criterion correlation when ties are present. Psychometrika 23, no. 3 (September 1958): 271-272. Thanks for any hint, Mulone 回答1: The "official" documentation is the code itself. And looking there, one sees that there is provision for

What is the function that will provide you the lower and upper bounds of correlation coefficient separately?

纵然是瞬间 提交于 2019-12-11 02:16:45
问题 m=c(1,2,5,4,6,8) h=c(1,2,9,8,7,3) cor(m,h) #[1] 0.4093729 If you estimate the correlation coefficient (R), then you can also estimate a 95% confidence interval for correlation coefficient (R), resulting in, for example something like R = 0.40 [0.33 0.56] where the "best" estimate for R is 0.40 and there's a 95% chance that the true R is between 0.3 and 0.56 . (Note that these numbers are completely made up.) I am looking for a function, which will provide the lower and upper bounds of R

Rolling Correlation with Groupby in Pandas

巧了我就是萌 提交于 2019-12-11 02:16:05
问题 Assuming I have a Pandas dataframe similar to the below, how would I get the rolling correlation (for 2 days in this example) between 2 specific columns and group by the 'ID' column? I am familiar with the Pandas rolling_corr() function but I cannot figure out how to combine that with the groupby() clause. What I have: ID Date Val1 Val2 A 1-Jan 45 22 A 2-Jan 15 66 A 3-Jan 55 13 B 1-Jan 41 12 B 2-Jan 87 45 B 3-Jan 82 66 C 1-Jan 33 34 C 2-Jan 15 67 C 3-Jan 46 22 What I need: ID Date Val1 Val2

Plotting multiple corrplots (R) in the same graph

余生长醉 提交于 2019-12-10 23:59:58
问题 Is it possible to plot several corrplot graphs in a single graph? Reproducible example: library(corrplot) data(mtcars) M <- cor(mtcars) col1 <- colorRampPalette(c("#7F0000","red","#FF7F00","yellow","white", "cyan", "#007FFF", "blue","#00007F")) corrplot(M, method="color", col=col1(20), cl.length=21,order = "AOE", addCoef.col="grey") corrplot(M, method="square", col=col1(200),order = "AOE") corrplot(M, method="ellipse", col=col1(200),order = "AOE") corrplot(M, method="shade", col=col1(20)

Calculate correlation between columns of strings

醉酒当歌 提交于 2019-12-10 23:31:43
问题 I've got a df that contains the columns profession and media. I would like to calculate the correlation between those two columns. Is there a short hack of calculating the correlation of columns of strings? Or do I have transform each profession and media to a number and then calculate the correlation with .corr()? I found a similar question (Is there a way to get correlation with string data and a numerical value in pandas?) but I would like to check the string, not each word within the

Goodness of fit in CCA in R

99封情书 提交于 2019-12-10 21:07:20
问题 The following are the datasets mm <- read.csv("https://stats.idre.ucla.edu/stat/data/mmreg.csv") colnames(mm) <- c("Control", "Concept", "Motivation", "Read", "Write", "Math", "Science", "Sex") psych <- mm[, 1:3] # dataset A acad <- mm[, 4:8] # dataset B For these datasets psych and acad,I wanted to do the canonical correlation analysis and obtained the canonical correlation coefficients and canonical loadings as follows: require(CCA) cc1 <- cc(psych, acad) I would like to know if there is a

Scheduling child activity that implements an interface with input parameters

泄露秘密 提交于 2019-12-10 17:26:29
问题 public sealed class Parent : NativeActivity { public Parent() { Childrens = new Collection<Activity>(); Variables = new Collection<Variable>(); _currentActivityIndex = new Variable<int>(); CurrentCustomTypeInstance= new Variable<MyCustomType>(); } [Browsable(false)] public Collection<Activity> Childrens { get; set; } protected override void Execute(NativeActivityContext context) { _currentActivityIndex.Set(context, 0); context.ScheduleActivity(FirstActivity, Callback); } private void Callback

Cross-correlation Code in C# [closed]

喜欢而已 提交于 2019-12-10 16:34:54
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 8 years ago . HI all, I have been hunting around for some code that implements various correlation coefficients (specifically cross-correlation) in C# to no avail. The