This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Correlation test based on position sliding window for multiple variables

Hello,

I have data like below. Based on position in I would like to correlate the data between each other, or do some statistics test to check the relationship of the 4 data (allele frequency, coverage, complexity1 and complexity2). For now I tried the corr.test of R library psych using a sliding window. Is this test adapted? Also, it is correlating only 2 values at a time, not all 4 values. Is it possible to correlate 4 values? Do you have any ideas of statistical test suitable for my purposes?

pos <- subs$position 
n <-length(pos) 
intervals <- cat(pos[1],pos[3:n])
result <- running(subs[,3], subs[,4], fun=corr.test,  
                  width=5, by=50, method="pearson", 
                  use = "pairwise.complete.obs", adjust ="BH",simplify=FALSE)
names(result) = intervals
tab = do.call(rbind,lapply(result,function(i)data.frame(i[1:10]))) 
tab = data.frame(intervals,tab)

position    freq    coverage    complex1    complex2
92  5   11355.658   1.3717151   1.0428568
101 3   11450.079   1.3828546   1.0424469
106 2   11479.711   1.3880071   1.0422836
107 10  11495.132   1.3879077   1.0422528
120 5   11612.053   1.3959816   1.0416549
132 7   11580.158   1.3830276   1.0406526
statistics r corr.test

0 answers

No answers yet.

Log in to answer this question.