powerSim: Dynamic simulation of power calculation in 1-sample mean...

Description Usage Arguments Details Value Examples

View source: R/sims-teaching.R

Description

This function plots the null and actual distributions, highlights the rejection region and the power region, and allows the user to dynamically manipulate the effect size, standard deviation, sample size, and alpha to determine the effect of these parameters on power.

Usage

1
2
3
4
5
6
7
8
powerSim(
  mu0 = 100,
  s.mua = 95,
  s.sigma = 10,
  s.n = 30,
  s.alpha = 0.05,
  lower.tail = TRUE
)

Arguments

mu0

A single numeric that is the null hypothesized mean

s.mua

A single numeric that is the starting value for the actual population mean

s.sigma

A single numeric that is the starting value for the actual population standard deviation

s.n

A single numeric that is the starting value for the sample size

s.alpha

A single numeric that is the starting value for alpha

lower.tail

A single logical that indicates if the rejection region is into the lower tail or not

Details

If the user is using RStudio and the manipulate package is installed then the dynamic graph is produced in the “Plots” pane of RStudio. The plot controls may be accessed through the “gear” that is in the upper-left corner of the plot.

Value

None, but a dynamic graphic with sliders is produced (if using RStudio).

Examples

1
2
3
4
5
## Not run: 
powerSim()
powerSim(lower.tail=FALSE)

## End(Not run)

droglenc/NCStats documentation built on June 5, 2021, 2:06 p.m.