[R] Power calculation with measurement error

Mike Lawrence Mike.Lawrence at DAL.CA
Tue Jun 26 20:38:45 CEST 2007


On 26-Jun-07, at 2:36 PM, Mike Lawrence wrote:
> On 26-Jun-07, at 8:12 AM, Mike Lawrence wrote:
>> Hi all,
>> Hopefully this will be quick, I'm looking for pointers to packages/
>> functions that would allow me to calculate the power of a t.test when
>> the DV has measurement error. That is, I understand that, ceteris
>> paribus, experiments using measure with more error (lower
>> reliability) will have lower power.
>
> I came across a reference (http://memetic.ca/reliability.pdf) that
> provides a formula for calculating the noncentrality parameter for
> tests using imperfect measures (see Eq. 4), as well as a table of
> some resulting power estimates. However, while I have created a (very
> slow) monte carlo function that so far as I can tell matches their
> results, when I attempt to implement their analytic solution it's way
> off. Can anyone see what I'm doing incorrectly?
>
> n=100
> r=.5 #reliability
> e=.5 #effect size
> delta=(sqrt(r*n)/2)*e
> power.t.test(n,delta,sig.level=.05,alternative='one.sided')
>
>       Two-sample t test power calculation
>
>                n = 100
>            delta = 1.767767
>               sd = 1
>        sig.level = 0.05
>            power = 1
>      alternative = one.sided
>
> NOTE: n is number in *each* group
>
>
> Meanwhile, their tables and my monte carlo method say that the power
> in that circumstance should be .7


Found it; I was using power.t.test without being thorough in reading  
its details. Sorry for the spam, and for anyone that's interested,  
here's the final analytic solution:

#get power for a t.test, incorporating measurement error.
#n = total number of participants across your 2 groups
#r = estimated reliability of the measure used
#e = measured effect size
get.power=function(n,r,e,tails=2,alpha=.05){
	d=(sqrt(r*n)/2)*e
	a=1-ifelse(tails==2,alpha/2,alpha)
	p=1-pt(qt(a,n-2),n-2,d)
	return(p)
}



More information about the R-help mailing list