# Re: [R] Z test and proportions

Date: Tue, 17 Jun 2008 17:23:02 +0100

I looked at the pwr.2p2n.test but i cannot place both n's and both p values to determine the sig value
e,g *pwr.2p2n.test(h = , n1 = , n2 = , sig.level = , power = )

or am i missing someting obvious?

```COMPUTE n1 = Control_MAX .
COMPUTE n2 = Exposed_max.
COMPUTE x1 = Control.
COMPUTE x2 = Exposed.

```

COMPUTE p1 = x1/n1.
COMPUTE p2 = x2/n2.
COMPUTE phat = (x1 + x2) / (n1 + n2).
COMPUTE SE_phat = SQRT(phat * (1 - phat) * ((1/n1) + (1/n2))). COMPUTE z = (p1 - p2) /SE_phat.

```COMPUTE SIGz_2TL = 2 * (1 - CDFNORM(ABS(z))).
COMPUTE SIGz_LTL = CDFNORM(Z).
COMPUTE SIGz_UTL = 1 - CDFNORM(Z).
```

COMPUTE SIG_Level = ABS(1-(1-CDFNORM(z))*2). Compute p1p = p1*100.
Compute p2p = p2*100.
compute diff = p2p-p1p.
EXE.
Var lab p1p "Control Group %".
Var lab p2p "Exposed Group %".

*

On Tue, Jun 17, 2008 at 5:13 PM, Peter Dalgaard <P.Dalgaard_at_biostat.ku.dk> wrote:

> Michael Pearmain wrote:
> > Hi All,
> >
> > I have a table based on ordial data and i want to compare proportions and
> > i've seen in the pwr package i can use
> > power.prop.test
> >
> > however i want to find out what the sig. value is based on n1,n2,p1,p2
> and
> > this package doesn't contain this..
> > Does anyone know of a package that does or is it a case of writting a
> > function specifically for this?
> >
> >
> I think your wired got crossed somewhere:
>
> power.prop.test is not from the pwr package; however, pwr does contain
> pwr.2p2n.test, which looks like it does exactly what you want!
>
>
> > Many thanks in advance
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help_at_r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>
> --
> O__ ---- Peter Dalgaard ุster Farimagsgade 5, Entr.B
> c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
> (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
> ~~~~~~~~~~ - (p.dalgaard_at_biostat.ku.dk) FAX: (+45) 35327907
>
>
>

```--
Michael Pearmain
Senior Statistical Analyst

1st Floor, 180 Great Portland St. London W1W 5QZ
t +44 (0) 2032191684
mpearmain_at_doubleclick.com

Doubleclick is a part of the Google group of companies

[[alternative HTML version deleted]]

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help