<?xml version="1.0" encoding="utf-8"?><!DOCTYPE article  PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'  'http://www.docbook.org/xml/4.4/docbookx.dtd'><article><articleinfo><title>FAQ/power/Runpeg</title><revhistory><revision><revnumber>4</revnumber><date>2013-03-08 10:17:13</date><authorinitials>localhost</authorinitials><revremark>converted to 1.6 markup</revremark></revision><revision><revnumber>3</revnumber><date>2008-01-21 15:54:48</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>2</revnumber><date>2008-01-21 15:39:26</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>1</revnumber><date>2008-01-21 15:38:44</date><authorinitials>PeterWatson</authorinitials></revision></revhistory></articleinfo><section><title>Sample size for unequal sized groups in an unpaired t-tests</title><para>Delta is the ratio of group 2 to group 1, pow is the power, alpha is the (two-tailed) type I error, the difference between the means is mdiff with common sd. Group 1 is outputted. NoteL: the power.t.test R function only handles equal sized groups. </para><para>[COPY AND PASTE INTO R AND, AMEND INPUTS AS DESIRED] </para><screen><![CDATA[delta <- 1
pow <- 0.8
alpha <- 0.05
mdiff <- 2
sd <- 4]]></screen><para>[THEN COPY AND PASTE THE BELOW INTO R] </para><screen><![CDATA[fn <- function(n1) {
(pow - (1 - pt(abs(qt(alpha/2,n1+(delta*n1)-2)), n1+(delta*n1)-2,
mdiff/sqrt((sd*sd)/n1+(sd*sd)/(n1*delta)))) )^2
 }
]]><![CDATA[
nout<- nlm(fn,2)
nout<- trunc(nout$estimate+1)
print(nout)]]></screen></section></article>