Learn R Programming

BayesRepDesign (version 0.42)

ssd: Sample size determination for replication success

Description

This function computes the standard error of the replication effect estimate required to achieve replication success with a certain probability and based on a certain type of success region.

Usage

ssd(
  sregionfun,
  dprior,
  power,
  nsites = 1,
  searchInt = c(.Machine$double.eps^0.5, 4),
  ...
)

Value

Returns an object of class "ssdRS" which is a list containing:

designPriorThe specified "designPrior" object
powerThe specified power
powerRecomputedThe recomputed power
srThe required replication standard error
cThe required relative sample size c = nr/no (assuming so = unitSD/no and sr = unitSD/nr)

Arguments

sregionfun

Function that returns the success region for replication effect estimate as a function of the replication standard error

dprior

Design prior object

power

Desired probability of replication success

nsites

Number of sites. Defaults to 1. The sites are assumed to have the same sample size

searchInt

Search interval for standard errors

...

Other arguments passed to uniroot

Author

Samuel Pawel

References

Pawel, S., Consonni, G., and Held, L. (2022). Bayesian approaches to designing replication studies. arXiv preprint. tools:::Rd_expr_doi("10.48550/arXiv.2211.02552")

Examples

Run this code
## specify design prior
to1 <- 2
so1 <- 1
dprior <- designPrior(to = to1, so = so1)

## compute required standard error for significance at one-sided 2.5%
sregionfunSig <- function(sr, alpha = 0.025) {
    successRegion(intervals = cbind(stats::qnorm(p = 1- alpha)*sr, Inf))
}
ssd(sregionfun = sregionfunSig, dprior = dprior, power = 0.8)

Run the code above in your browser using DataLab