I'm going to go out on a limb and guess that you want to apply the the t-test for each row in your data.frame and the fields are labeled 'case1','control1', etc. methySample <- data.frame(case1=rnorm(10), case2=rnorm(10), control1=rnorm(10), control2=rnorm(10)) # identify the fields that are labeled 'case' and 'control' caseFields <- grep('case',colnames(methySample),...

You can save the p-value from the t-test to another variable with something like: pVal <- t.test(1:10, y = c(7:20))$p.value pVal will then be numeric: > str(pVal) num 1.86e-05 ...

The code: p.adjust # typed at command line prints out the code # copy the body of the function ... is really very simple and all R. Just redefine a function that comments out that stopifnot() line: my.p.adj <- function (p, method = p.adjust.methods, n = length(p)) # paste the...

It sounds like you are after a binomial probability (the probability that randomly dividing the edges between the two types will yield the same distribution as originally observed). You can compute these probabilities using the dbinom() function: transform( df, prob_same = dbinom(G_obs, G_obs + R_obs, prob = .5) ) data...

python,statistics,scipy,p-value

The degrees of freedom you are passing to the formula are negative. In [6]: import numpy as np from scipy.special import stdtr dof = -2176568 tf = -11.374250 2*stdtr(dof, -np.abs(tf)) Out[6]: nan If positive: In [7]: import numpy as np from scipy.special import stdtr dof = 2176568 tf...

python,r,statistics,rpy2,p-value

The problem was binom.names is a StrVector, and does not support index, however it can be converted to a Python list easily enough,and then extract those values. my_vec = R.IntVector([count_a,count_b]) binom=R.r['binom.test'](my_vec) names= binom.names names = list(names) P_val= binom[names.index('p.value')][0] For more clarifications,visit this blog http://telliott99.blogspot.com/2010/11/rpy-r-from-python-2.html...

The F-statistic and p-value will not conflict with each other. The p-value is a measure of how extreme the F-statistic is - it's a tail probability from the F distribution. So, for example, suppose your criterion of choosing the alternative hypothesis is a p-value less than or equal to 0.05...

python,statistics,scipy,p-value

Re what happens here internally. Well, the Student t distribution is defined for dof > 0, at least in scipy.stats: http://docs.scipy.org/doc/scipy-dev/reference/generated/scipy.stats.t.html. Hence a nan: In [11]: stats.t.sf(-11, df=10) Out[11]: 0.99999967038443183 In [12]: stats.t.sf(-11, df=-10) Out[12]: nan ...

Here's one way using dplyr. It would probably be better to combine the first three lines into a single step if you've got large matrices, but I separated them for clarity. I think the chi-squared case would be a fairly simple extension. z0_melt = melt(z0, value.name='z0')[,c('Var2','z0')] z1_melt = melt(z1, value.name='z1')[,c('Var2','z1')]...

You are mistaking what the significance means in terms of the p-value. I will try to explain below: Let's assume a test about the means of two populations being equal. We will perform a t-test to test that by drawing one sample from each population and calculating the p-value. The...

matlab,machine-learning,feature-extraction,p-value

You need to perform an ANOVA (Analysis of Variance) test for each of the voxels. From the above linked Wikipedia page: In its simplest form, ANOVA provides a statistical test of whether or not the means of several groups are equal, and therefore generalizes the t-test to more than two...

The p-values that are estimated are: coef(summary(model))[, 4] Regarding the reference levels, the model is using treatment contrasts so the values of the reference levels are all zero thus its not meaningful to ask for their p-values....

p-values is used for testing the hypothesis of no correlation and it is actually one of the outputs of the correlation analysis not a parameter to change. by definition: Each p-value is the probability of getting a correlation as large as the observed value by random chance, when the true...

r,data.frame,extraction,p-value

If you want to compare the res against sens for each Protein columns grp <- sub(".* ", "", df$X) Pvals <- mapply(function(x,y) t.test(x[grp=='res'], x[grp=='sens'])$p.value, df[,-1], list(grp)) Pvals[Pvals < 0.05] Or using data.table library(data.table) setDT(df)[, grp:= sub('.* ', "", X)][, lapply(.SD, function(x) t.test(x[grp=='res'], x[grp=='sens'])$p.value), .SDcols=2:(ncol(df)-1)] data df <- structure(list(X = c("A...