: [pval, z] = prop_test_2 (x1, n1, x2, n2, alt)

If x1 and n1 are the counts of successes and trials in one sample, and x2 and n2 those in a second one, test the null hypothesis that the success probabilities p1 and p2 are the same.

Under the null, the test statistic z approximately follows a standard normal distribution.

With the optional argument string alt, the alternative of interest can be selected. If alt is "!=" or "<>", the null is tested against the two-sided alternative p1 != p2. If alt is ">", the one-sided alternative p1 > p2 is used. Similarly for "<", the one-sided alternative p1 < p2 is used. The default is the two-sided case.

The p-value of the test is returned in pval.

If no output argument is given, the p-value of the test is displayed.

Package: statistics