It looks like the pwr.p.test function from the pwr package would do what you
want.
-----Original Message-----
From: r-help-bounces@stat.math.ethz.ch on behalf of Chris Evans
Sent: Sun 7/30/2006 12:53 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Power of a single sample binomial test
The only references to this I can find searching the archives are to a
student who asked in relation to his course work on a stats course.
Promise I'm not doing that!
I have a situation in which we want to test proportions against an
expected proportion, binom.test() is great. I'd like to do some post
hoc power tests (the x and n were beyond our control in the survey as
all we could set was an overall n.max where n < n.max, n is between 1
and 44).
I would love to work out our power to have detected a proportions
different from the expected (.307). I've run two-tailed binomial tests
as we were interested in both high and low. We can not unreasonably
confine to the directional prediction of observed x/n << .307, say <.15
if that makes the maths easier. I can't see functions in R that will do
this for me. The only book I seem to have to hand that addresses this is:
Kraemer, H. C. & Thiemann, S. (1988) How many subjects? Statistical
power analysis in research. Newbury Park California, Sage Publications, Inc.
which I appreciate is ageing but I assume still correct. The problem I
have is that I can use R to get Kraemer's upper case delta (p.77) and
look up in their "Master table" but I'd love a more flexible
function
that would say solve for power where p1, n, p0 and alpha are given. I
think I ought to be able to work out how their master table was
calculated and work from that but I'm finding the mathematics a bit
opaque for my ageing brain. Their model is clearly one-tailed. I'm not
sure how one works a two-tailed power.
A search around for web calculators etc. turns up all manner of things,
some probably good, some dead etc. I'd hugely appreciate if someone
here could share anything they may have in R or point me to R solutions
I may have missed.
TIA,
Chris
--
Chris Evans <chris@psyctc.org>
Professor of Psychotherapy, Nottingham University;
Consultant Psychiatrist in Psychotherapy, Rampton Hospital;
Research Programmes Director, Nottinghamshire NHS Trust;
Hon. SL Institute of Psychiatry, Hon. Con., Tavistock & Portman Trust
**If I am writing from one of those roles, it will be clear. Otherwise**
**my views are my own and not representative of those institutions **
______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]