userfriendlyscience (version 0.5-2)

showPearsonPower: Visualisation of the power of a Pearson correlation test

Description

This fuction is useful when conducting power analyses for a Pearson correlation. It draws the sampling distribution of Pearson's r assuming a null hypothesis value of r and assuming a the hypothetical population value. The probability of making a Type 1 error is also illustrated.

Usage

showPearsonPower(n = 100, rho = 0.3, rNull = 0, distLabels = c("Null Hypothesis", "Population"), rhoColor = "green", rhoFill = "green", rhoAlpha = 0.1, rhoLineSize = 1, rNullColor = "blue", rNullFill = "blue", rNullAlpha = 0.1, rNullLineSize = 1, type2Color = "red", type2Fill = "red", type2Alpha = 0.1, type2LineSize = 0, theme = dlvTheme(), alpha = 0.05, digits = 3)

Arguments

n
The number of participants.
rho
The value of the correlation coefficient in the population.
rNull
The value of the correlation coefficient according to the null hypothesis.
distLabels
Labels for the two distributions; the first one is the null hypothesis distribution, the second one the alternative distribution.
rhoColor, rNullColor, type2Color
The border colors of the distributions and the region used to illustrate the Type 2 error probability.
rhoFill, rNullFill, type2Fill
The fill colors of the distributions and the region used to illustrate the Type 2 error probability.
rhoAlpha, rNullAlpha, type2Alpha
The alpha (transparency) of the distributions and the region used to illustrate the Type 2 error probability.
rhoLineSize, rNullLineSize, type2LineSize
The line thicknesses of the distributions and the region used to illustrate the Type 2 error probability.
theme
The theme to use.
alpha
The significance level (alpha) of the null hypothesis test.
digits
The number of digits to round to.

Value

A ggplot plot is returned.

See Also

didacticPlot

Examples

Run this code
## Not run: 
# showPearsonPower();
# ## End(Not run)

Run the code above in your browser using DataLab