# ttest.ppow: Compute the power using a one- or two-sample unpaired t-test... In julianje/mcpa: Intuitive power analyses through monte carlo simulations

## Description

`ttest.ppow` computes (via simulation) the power of an experiment that will be analyzed using a t-test. Rather than taking a theoretical distribution, this function takes empirical data and bootstraps them to calculate the power. For an equivalent function that does not rely on pilot data see ttest.pow.

`ttest.ppow` computes (via simulation) the power of an experiment that will be analyzed using a t-test. Rather than taking a theoretical distribution, this function takes empirical data and bootstraps them to calculate the power. For an equivalent function that does not rely on pilot data see ttest.pow.

## Usage

 ```1 2 3 4 5``` ```ttest.ppow(x, y = NULL, n, r = 10000, alternative = c("two.sided", "less", "greater"), mu = NULL, alpha = 0.05, conf.level = 0.95) ttest.ppow(x, y = NULL, n, r = 10000, alternative = c("two.sided", "less", "greater"), mu = NULL, alpha = 0.05, conf.level = 0.95) ```

## Arguments

 `x` a data frame with two columns, or a list with pilot data. `y` a list with pilot data. When x is a list and y is not provided, a one-tailed t-test is used. `n` sample size. `r` number of simulations to compute power. `alternative` type of alternative hypothesis in binomial test. Must be "`two.sided`" (default), "`greater`", or "`less`". `mu` mean value according to null hypothesis (default = `0`). Only used in one sample t-tests. `alpha` significance threshhold. `x` a data frame with two columns, or a list with pilot data. `y` a list with pilot data. When x is a list and y is not provided, a one-tailed t-test is used.

## Value

The probability of finding p < α with the experiment description.

The probability of finding p < α with the experiment description.

`ttest.pow`, `ttest.ppow`, `ttest.explore`, and `ttest.pexplore`.
 ```1 2 3 4 5 6``` ```ttest.ppow(x=c(0, 5, 10), n=16) # Power for a one-sample t-test with n=16. Pilot data consists of three data points. ttest.ppow(x=c(0, 5, 10), n=16, mu = -5) # Same as above, changing the avarege under the null to -5. ttest.ppow(x=c(0, 5, 10), y=c(9, 3, 2, 1), n=30) # Power for a two-sample t-test with n=30 (per condition) using unbalanced pilot data. ttest.ppow(x=c(0, 5, 10), n=16) # Power for a one-sample t-test with n=16. Pilot data consists of three data points. ttest.ppow(x=c(0, 5, 10), n=16, mu = -5) # Same as above, changing the avarege under the null to -5. ttest.ppow(x=c(0, 5, 10), y=c(9, 3, 2, 1), n=30) # Power for a two-sample t-test with n=30 (per condition) using unbalanced pilot data. ```