p-value

R small pvalues

梦想的初衷 提交于 2019-12-24 02:28:10
问题 I am calculating z-scores to see if a value is far from the mean/median of the distribution. I had originally done it using the mean, then turned these into 2-side pvalues. But now using the median I noticed that there are some Na's in the pvalues. I determined this is occuring for values that are very far from the median. And looks to be related to the pnorm calculation. " 'qnorm' is based on Wichura's algorithm AS 241 which provides precise results up to about 16 digits. " Does anyone know

How to extract the p.value and estimate from cor.test()?

瘦欲@ 提交于 2019-12-23 21:16:45
问题 I perform cor.test for a dataset in a for loop, but I don't know how to extract the information like estimate and tau from my test. Before performing for loop in the dataset, The cor.test() function returns as follows: cor.test(armpit$Corynebacterium.1, armpit$Staphylococcus.1, alterantive="two-sided", method="kendall", exact=FALSE, continuity=TRUE) return result Here is my code for performing for loop. Now I want to extract estimate and tau from my test. for (i in 1:8) { for (j in 1:8) { if

How do I annotate p-values onto a faceted bar plots on R?

匆匆过客 提交于 2019-12-23 05:50:33
问题 I'd like to know if it's possible to annotate p-values at the top of the graph and in between 2 bar plots. In my case, using ggplot2, I have a faceted graph with 2 conditions (Passage and Isolated) and in each condition, there are 3 levels/3 bar graphs (GA, CH, KO). If it's possible, I have some p-values from pairwise comparisons (GA vs CH, CH vs KO, GA vs KO) that I would like to show on the graph itself. My ggplot script is below: #plot dev.new() accentrating_comb <- ggplot(ch_ko_am_comb,

Bootstrapped p-value for a correlation coefficient on R

陌路散爱 提交于 2019-12-21 22:39:25
问题 On R , I used the boostrap method to get a correlation coefficient estimation and the confidence intervals. To get the p-value, I thought, I can calculate the proportion of the confidence intervals which do not contain zero. But this is not the solution. How can I get the p-value in this case ? I am using cor.test to get the coefficient estimation. cor.test may also gives me the p-value from every test. But how can I get the bootstrapped p-value ? Thank you very much ! Below an example : n=30

R语言:常用统计检验

ぐ巨炮叔叔 提交于 2019-12-20 07:41:37
统计检验是将抽样结果和抽样分布相对照而作出判断的工作。主要分5个步骤: 建立假设 求抽样分布 选择显著性水平和否定域 计算检验统计量 判定 —— 百度百科 假设检验(hypothesis test)亦称显著性检验(significant test),是统计推断的另一重要内容,其目的是比较总体参数之间有无差别。假设检验的实质是判断观察到的“差别”是由抽样误差引起还是总体上的不同,目的是评价两种不同处理引起效应不同的证据有多强,这种证据的强度用概率P来度量和表示。除t分布外,针对不同的资料还有其他各种检验统计量及分布,如F分布、X2分布等,应用这些分布对不同类型的数据进行假设检验的步骤相同,其差别仅仅是需要计算的检验统计量不同。 正态总体均值的假设检验 t检验 t.test() => Student's t-Test require(graphics) t.test(1:10, y = c(7:20)) # P = .00001855 t.test(1:10, y = c(7:20, 200)) # P = .1245 -- 不在显著 ## 经典案例: 学生犯困数据 plot(extra ~ group, data = sleep) ## 传统表达式 with(sleep, t.test(extra[group == 1], extra[group == 2])) Welch Two

python: How to add p values signifance to barplot

假如想象 提交于 2019-12-13 20:53:56
问题 Below i have a code for the barplot, I would also like to show the Pvalue significane for these plots. Is there any easy way to indicate the statistical significance for these bars import matplotlib.pyplot as plt X= [-0.9384815619939103, 1.0755888058123153, 0.061274066731665564, 0.65064830688728] x_labels = ['A' ,'B', 'C', 'D'] error = [0.23722952107696088, 0.25505883348061764, 0.26038015798295744, 0.26073839861422] pvalue = [0.000076, 0.000025, 0.813956, 0.012581] fig, ax = plt.subplots() ax

T-Test For Genes using Apply Function in Dataframe

[亡魂溺海] 提交于 2019-12-13 08:19:45
问题 I’m trying to run a t.test on two data frames. The dataframes (which I carved out from a data.frame) has the data I need to rows 1:143. I’ve already created sub-variables as I needed to calculate rowMeans. > c.mRNA<-rowMeans(c007[1:143,(4:9)]) > h.mRNA<-rowMeans(c007[1:143,(10:15)]) I’m simply trying to run a t.test for each row, and then plot the p-values as histograms. This is what I thought would work… Pvals<-apply(mRNA143.data,1,function(x) {t.test(x[c.mRNA],x[h.mRNA])$p.value}) But I

How to put significance level (p-value) on barplot in ggplot2 automatically?

徘徊边缘 提交于 2019-12-13 04:18:19
问题 I saw a similar answer already asked here, but the mine is little bit different. Is there a way to calculate significance and put the stars on the barplot, automatically in ggplot? I have a plot with barplot that represent the mean of an entire season, for some variables (compounds), and other three layers with point, line and errorbars of the average of specific time windows (phenological stages) into the complete season. I want just to put asterisks over barplots of the total season average

Obtaining regression coefficients from reduced major axis regression models using lmodel2 package

ぐ巨炮叔叔 提交于 2019-12-12 04:59:41
问题 I have a large data set with which I'm undertaking many regression analyses. I'm using a reduced major axis regression with r's lmodel2 package. What I need to do is extract the regression coefficients (r-squared, p-values, slope and intercept) from the RMA models. I can do this easily enough with the OLS regressions using: RSQ<-summary(model)$r.squared PVAL<-summary(model)$coefficients[2,4] INT<-summary(model)$coefficients[1,1] SLOPE<-summary(model)$coefficients[2,1] And then export them in

chi-square - two sample test in r

本秂侑毒 提交于 2019-12-12 04:33:54
问题 There is in R a function to perform a chi-square two sample test ?http://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/chi2samp.htm For example I whant to prove if x = rnorm(100) and y = rnorm(100) come from the same distribution. I tried to use the chisq.test function, but I think it is not correct because it gives me a very large p-value > chisq.test(rnorm(100),runif(100)) Pearson's Chi-squared test data: rnorm(100) and runif(100) X-squared = 9900, df = 9801, p-value = 0.239