# approximate correlation power calculation (arctangh transformation) # Conventional effect size from Cohen (1982) It is simply the hypothesized correlation. There is nothing tricky about the effect size argument, r. If you have the ggplot2 package installed, it will create a plot using ggplot. The pwr package provides a generic plot function that allows us to see how power changes as we change our sample size. If we desire a power of 0.90, then we implicitly specify a Type II error tolerance of 0.10. Our tolerance for Type II error is usually 0.20 or lower. This is thinking there is no effect when in fact there is. Type II error, \(\beta\), is the probability of failing to reject the null hypothesis when it is false. Our tolerance for Type I error is usually 0.05 or lower. This is considered the more serious error. This is thinking we have found an effect where none exist. Type I error, \(\alpha\), is the probability of rejecting the null hypothesis when it is true. The alternative argument says we think the alternative is “greater” than the null, not just different. It is sometimes referred to as 1 - \(\beta\), where \(\beta\) is Type II error. This is also sometimes referred to as our tolerance for a Type I error (\(\alpha\)). (More on effect size below.) sig.level is the argument for our desired significance level. The function ES.h is used to calculate a unitless effect size using the arcsine transformation. Our effect size is entered in the h argument. Notice that since we wanted to determine sample size ( n), we left it out of the function. If we're correct that our coin lands heads 75% of the time, we need to flip it at least 23 times to have an 80% chance of correctly rejecting the null hypothesis at the 0.05 significance level. The function tells us we should flip the coin 22.55127 times, which we round up to 23. # proportion power calculation for binomial distribution (arcsine transformation) Here is how we can determine this using the pwr.p.test function. How many times should we flip the coin to have a high probability (or power), say 0.80, of correctly rejecting the null of \(\pi\) = 0.5 if our coin is indeed loaded to land heads 75% of the time? Our alternative hypothesis is that the coin is loaded to land heads more then 50% of the time (\(\pi\) > 0.50).Our null hypothesis is that the coin is fair and lands heads 50% of the time (\(\pi\) = 0.50).If our p-value falls below a certain threshold, say 0.05, we will conclude our coin's behavior is inconsistent with that of a fair coin. We will judge significance by our p-value. We will then conduct a one-sample proportion test to see if the proportion of heads is significantly different from what we would expect with a fair coin. We will flip the coin a certain number of times and observe the proportion of heads. We wish to create an experiment to test this. Let's say we suspect we have a loaded coin that lands heads 75% of the time instead of the expected 50%. All of these are demonstrated in the examples below. There are also a few convenience functions for calculating effect size as well as a generic plot function for plotting power versus sample size. pwr.f2.test: test for the general linear model.: chi-squared test (goodness of fit and association).: two-sample t-tests (unequal sample sizes).pwr.t.test: two-sample, one-sample and paired t-tests. : two-sample proportion test (unequal sample sizes).pwr.2p.test: two-sample proportion test.Functions are available for the following statistical tests: All functions for power and sample size analysis in the pwr package begin with pwr. If you plan to use a two-sample t-test to compare two means, you would use the pwr.t.test function for estimating sample size or power. You select a function based on the statistical test you plan to use to analyze your data. Whatever parameter you want to calculate is determined from the others. If you want to calculate sample size, leave n out of the function. If you want to calculate power, then leave the power argument out of the function. The basic idea of calculating power or sample size with functions in the pwr package is to leave out the argument that you want to calculate.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |