<?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/powrsqR</title><revhistory><revision><revnumber>2</revnumber><date>2013-03-08 10:17:55</date><authorinitials>localhost</authorinitials><revremark>converted to 1.6 markup</revremark></revision><revision><revnumber>1</revnumber><date>2008-01-29 15:13:43</date><authorinitials>PeterWatson</authorinitials></revision></revhistory></articleinfo><section><title>Computing power for one-way ANOVA in R</title><para>For type I error, alpha, regression degrees of freedom (= k-1 for k groups) and dfc covariates with a total sample size, ntot, a test to detect a R-squared of rsq has power, pow. </para><para>[COPY AND PASTE THE BELOW INTO R, ADJUST AS DESIRED] </para><screen><![CDATA[alpha <- 0.05
dfreg <- 2
dfc <- 1
ntot <- 23
rsq <- 0.2]]></screen><para>[COPY AND PASTE THE BELOW INTO R] </para><screen><![CDATA[pow <- 1 - pf(abs(qf(1-alpha,dfreg,ntot-dfreg-dfc-1)),dfreg,ntot-dfreg-dfc-1,
ntot*rsq/(1-rsq))
print(pow) ]]></screen></section></article>