简体   繁体   中英

Exact binomial test in SAS or SPSS?

I have 400,000 rows, each with an id, number of trials, and number of successes.

I have (one) value for p, a hypothesized probability of success.

I'd like to calculate an exact, binomial, one-sided p-value for each row, using its trials successes, and the global p.

Eg,

1001 10 2

should give me

1001 10 2 2.639011e-01 for the probability of 2 successes or more.

I'd prefer a solution in SAS, but SPSS is also useful.

Thanks!

You can use the binomial distribution directly:

data yourdata;
   set yourdata;
   p_lower = PROBBNML(globalp, ntrials, nsuccesses);
   p_higher = 1 - PROBBNML(globalp, ntrials, nsuccesses-1);
run;

I have not tested whether PROBBNML will work with -1 responses, so you might need to test for nsuccesses=0 before using the p_higher formula.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM