# establishing parameter values for linear regression power analysis using pwr package in R

I'm designing an experiment and trying to do a power analysis do determine how many participants I will need for my experiment to be able to unearth a small effect size (if feasible). I am not exactly sure how to calculate the values for the parameter values that I feed into the pwr package function for linear regression in R.

The function is the following:

pwr.f2.test(u =, v = , f2 = , sig.level = , power = )


where u and v are the numerator and denominator degrees of freedom respectively. We use f2 as the effect size measure. If your arguments are supplied, then the function outputs the fifth argument, in my case power which stands for the number of participants. I need advice on how to calculate the values for some of the other parameters.

My significance level is 0.05 and the effect size value is 0.02 for a small effect size. Cohen (1988) suggests f2 values of 0.02, 0.15, and 0.35 represent small, medium, and large effect sizes.

I determine u by calculating p (the number of predictors) - 1. My factor variables are experimental condition (4 dimensions), stress position (2 dimensions), and vowel (2 dimensions). My continuous variables are frequency and vowel-to-consonant ratio. How do I calculate p from this. Do I just count the variables regardless of whether they are factors or continuous variables (in which case I have p=5) or do I count each dimension of my factors as 1 (in which case p=10)?

I determine v by calculating n-p, where p is the number of predictors and n is the number of observations. In my case n=60 but I'm not sure how to calculate p (see above).

So what I need to find out is how to correctly determine p with factors and continuous variables.

Assuming this is ordinary fixed-effects anova, factors will count as one fewer than the number of levels. If you're including interactions between factors with $k_1$ and $k_2$ levels then it's $(k_1-1)\times(k_2-1)$. You'll also have a constant term (an intercept or a grand mean or similar depending on your coding).