STATS_BINOMIAL_TEST

Syntax Description of the illustration stats_binomial_test.gif

Purpose

STATS_BINOMIAL_TEST is an exact probability test used for dichotomous variables, where only two possible values exist. It tests the difference between a sample proportion and a given proportion. The sample size in such tests is usually small.

This function takes four arguments: expr1 is the sample being examined. expr2 contains the values for which the proportion is expected to be, and p is a proportion to test against. The fourth argument is a return value of type VARCHAR2. If you omit the fourth argument, then the default is TWO_SIDED_PROB. The meaning of the return values is shown in Table 5-3.

Table 5-3 STATS_BINOMIAL Return Values

Return Value Meaning

TWO_SIDED_PROB

The probability that the given population proportion, p, could result in the observed proportion or a more extreme one.

EXACT_PROB

The probability that the given population proportion, p, could result in exactly the observed proportion.

ONE_SIDED_PROB_OR_MORE

The probability that the given population proportion, p, could result in the observed proportion or a larger one.

ONE_SIDED_PROB_OR_LESS

The probability that the given population proportion, p, could result in the observed proportion or a smaller one.

EXACT_PROB gives the probability of getting exactly proportion p. In cases where you want to test whether the proportion found in the sample is significantly different from a 50-50 split, p would normally be 0.50. If you want to test only whether the proportion is different, then use the return value TWO_SIDED_PROB. If your test is whether the proportion is more than the value of expr2, then use the return value ONE_SIDED_PROB_OR_MORE. If the test is to determine whether the proportion of expr2 is less, then use the return value ONE_SIDED_PROB_OR_LESS.

STATS_BINOMIAL_TEST Example The following example determines the probability that reality exactly matches the number of men observed under the assumption that 69% of the population is composed of men:

SELECT AVG(DECODE(cust_gender, 'M', 1, 0)) real_proportion,
STATS_BINOMIAL_TEST
(cust_gender, 'M', 0.68, 'EXACT_PROB') exact,
STATS_BINOMIAL_TEST
(cust_gender, 'M', 0.68, 'ONE_SIDED_PROB_OR_LESS') prob_or_less
FROM sh.customers;
{"ft_lang_label":"__label__en","ft_lang_prob":0.73481196,"math_prob":0.9157968,"size":1998,"snap":"2022-05-2022-21","text_gpt3_token_len":478,"char_repetition_ratio":0.15797392,"word_repetition_ratio":0.11551155,"special_character_ratio":0.23173173,"punctuation_ratio":0.125,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99913055,"pos_list":[0,1,2],"im_url_duplicate_count":[null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-01-27T04:40:50Z\",\"WARC-Record-ID\":\"<urn:uuid:1a503905-a16a-4843-8436-7e3f2c93ee84>\",\"Content-Length\":\"13829\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:114477b1-dde0-4f65-8389-7497d30fe6a3>\",\"WARC-Concurrent-To\":\"<urn:uuid:e0e2e7b7-aef9-4b53-a073-6f11130980dd>\",\"WARC-IP-Address\":\"172.87.28.107\",\"WARC-Target-URI\":\"http://devdoc.net/database/OracleDoc_11gR2/server.112/e26088/functions169.htm\",\"WARC-Payload-Digest\":\"sha1:NTOUW6KEBWLECUY4ZHTLASNZWJQNPYZQ\",\"WARC-Block-Digest\":\"sha1:3XPLDQTAILOUHOYAWG4EBB2UWDELSQXK\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-05/CC-MAIN-2022-05_segments_1642320305141.20_warc_CC-MAIN-20220127042833-20220127072833-00433.warc.gz\"}"}