BSDT_cov_power: Power calculator for BSDT_cov

Description Usage Arguments Value Examples

View source: R/dissoc_power.R

Description

Computationally intense. Lower iter and/or nsim for faster but less precise calculations. Calculates approximate power, given sample size, using Monte Carlo simulation for BSDT with covariates for specified (expected) case score, means and standard deviations for the control sample on the task of interest and included covariates. The number of covariates defaults to 1, means and standard deviations for the tasks and covariate default to 0 and 1, so if no other values are given the case scores is interpreted as deviation from the mean in standard deviations for both tasks and covariates.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
BSDT_cov_power(
  case_tasks,
  case_cov,
  control_tasks = matrix(c(0, 0, 1, 1), ncol = 2),
  control_covar = c(0, 1),
  cor_mat = diag(3) + 0.3 - diag(c(0.3, 0.3, 0.3)),
  sample_size,
  alternative = c("two.sided", "greater", "less"),
  alpha = 0.05,
  nsim = 1000,
  iter = 1000,
  calibrated = TRUE
)

Arguments

case_tasks

A vector of length 2. The expected case scores from the tasks of interest.

case_cov

A vector containing the expected case scores on all covariates included.

control_tasks

A 2x2 matrix or dataframe containing the expected means (first column) and standard deviations (second column). Defaults to two variables with means 0 and sd = 1.

control_covar

A px2 matrix or dataframe containing the expected means (first column) and standard deviations (second column), p being the number of covariates. Defaults to one covariate with mean 0 and sd = 1.

cor_mat

A correlation matrix containing the correlations of the tasks of interest and the coviariate(s). The first two variables are treated as the tasks of interest. Defaults pairwise correlations between the variates of 0.3.

sample_size

Single value giving the size of the control sample for which you wish to calculate power.

alternative

The alternative hypothesis. A string of either "less", "greater" or "two.sided" (default).

alpha

The specified Type I error rate, default is 0.05. This can be varied, with effects on power.

nsim

The number of simulations for the power calculation. Defaults to 1000 due to BSDT already being computationally intense. Increase for better accuracy.

iter

The number of simulations used by the BSDT_cov, defaults to 1000. Increase for better accuracy.

calibrated

Whether or not to use the standard theory (Jeffreys) prior distribution (if set to FALSE) or a calibrated prior. See Crawford et al. (2011) for further information. Calibrated prior is recommended.

Value

Returns a single value approximating the power of the test for the given parameters.

Examples

1
2
3
BSDT_cov_power(c(-2, 0), case_cov = c(0, 0, 0),
control_covar = matrix(c(0, 0, 0, 1, 1, 1), ncol= 2),
sample_size = 10, cor_mat = diag(5), iter = 20, nsim = 20)

singcar documentation built on March 1, 2021, 5:07 p.m.