How to do a OneSampleZTest for the proportion instead of the mean?

I am playing around with the HypothesisTests package and wanted to do a OneSampleZTest but with the population proportion instead of the populatin mean as the parameter of interest. But I really don’t find anyting in the documentation that tells me how to do it.

link to docs

Maybe somebody can show me how to to it?

There is no difference as proportion is mean of a sample from a binary variable.
So if your proportion is p and sample size is n then:

OneSampleZTest(p, sqrt(p*(1-p)*n/(n-1)), n)
3 Likes