r - extract verbatim p-value from cor.test -


i ran correlation analysis between 2 vectors , need plot -log10(pvalue)...when correlation runs, have following results:

data <- read.table("test-data.txt") <- data[,1] b <- data[,2] test <- cor.test(a, b) test      pearson's product-moment correlation  data:  , b t = 8.3704, df = 10352, p-value < 2.2e-16 alternative hypothesis: true correlation not equal 0 95 percent confidence interval:  0.06282908 0.10109436 sample estimates:        cor  0.08199194  

but when extract p-value test$p.value comes out zero..this means when calculate -log10(pv) inf results...which cannot plot.

however, -log(2.2e-16, base=10) 15.65758 want

so question is: how maintain exponential number?

also, sample of series of 81 correlations i'm running have plotted together, have same problem 30 out of 81

your p-value not 2.2e-16, less that. means computationally zero. can skip zeros, or set 0 arbitrarily small 2.2e-16.

ifelse(pv==0,-log(2.2e-16,base=10),-log(pv,base=10)) 

of course, 30 out of 81 times not know p-value is, small.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -