Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do extract the p value from a binomial test

Tags:

r

extract

p-value

I have the result of a binomial test and it looks like this:

data:  x and n
number of successes = 0, number of trials = 7, p-value = 0.01563
alternative hypothesis: true probability of success is not equal to 0.5
95 percent confidence interval:
 0.0000000 0.4096164
sample estimates:
probability of success 
                     0 

All I would like to know is how to extract just the p-value in R. I tried grep and pmatch but they appear to require a table or vector.

like image 543
Gotmadstacks Avatar asked May 17 '26 05:05

Gotmadstacks


1 Answers

You only need to do:

binom.test(3,15)$p.value

Take a look at str(binom.test(3,15)) to see the other results from the binomial test. 3 and 15 are chosen arbitrarily so long as second number is larger than the first.

like image 58
Freddy Avatar answered May 18 '26 22:05

Freddy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!