# randomizationSuccess

##### Computations for successful randomization

`prob.randomizationSuccess`

computes the probability that two groups are
equivalent given a specific sample size, number of nuisance variables,
and definition of 'equivalence' (in terms of the Cohen's d expressing the
maximum acceptable difference between the groups on any of the nuisance
variables).

`pwr.randomizationSuccess`

computes the sample size required to make randomization
succeed in a specified proportion of the studies with a two-cell design.
'Success' is defined as the two groups differing at most with a specified
effect size on any of a given number or nuisance variables.

##### Usage

```
prob.randomizationSuccess(n = 1000,
dNonequivalence = .2,
nNuisanceVars = 100)
pwr.randomizationSuccess(dNonequivalence = 0.2,
pRandomizationSuccess = 0.95,
nNuisanceVars = 100)
```

##### Arguments

- n
The sample size.

- dNonequivalence
The maximum difference between the two groups that is deemed acceptable.

- pRandomizationSuccess
The desired probability that the randomization procedure succeeded in generating two equivalent groups (i.e. differing at most with

`dNonequivalence`

).- nNuisanceVars
The number of nuisance variables that the researchers assumes exists.

##### Details

For more details, see Peters & Gruijters (2017).

##### Value

For `prob.randomizationSuccess`

, the probability that the two groups
are equivalent. The function is vectorized, so returns either a vector
of length one, a vector of length > 1, a matrix, or an array.

For `pwr.randomizationSuccess`

, the required sample size. The function is
vectorized, so returns either a vector of length one, a vector of
length > 1, a matrix, or an array.

##### References

Peters, G. J.-Y. & Gruijters, S. Why your experiments fail: sample sizes required for randomization to generate equivalent groups as a partial solution to the replication crisis (2017). http://dx.doi.org/

##### See Also

##### Examples

```
# NOT RUN {
### To be on the safe side: sample size required to
### obtain 95% likelihood of success when assuming
### 100 nuisance variables exist.
pwr.randomizationSuccess(dNonequivalence = 0.2,
pRandomizationSuccess = 0.95,
nNuisanceVars = 100);
### Living on the edge:
pwr.randomizationSuccess(dNonequivalence = 0.2,
pRandomizationSuccess = 0.60,
nNuisanceVars = 10);
### For those with quite liberal ideas of 'equivalence':
pwr.randomizationSuccess(dNonequivalence = 0.5,
pRandomizationSuccess = 0.95,
nNuisanceVars = 100);
### And these results can be checked with
### prob.randomizationSuccess:
prob.randomizationSuccess(1212, .2, 100);
prob.randomizationSuccess(386, .2, 10);
prob.randomizationSuccess(198, .5, 100);
### Or in one go:
prob.randomizationSuccess(n=c(198, 386, 1212), c(.2, .5), c(10, 100));
# }
```

*Documentation reproduced from package userfriendlyscience, version 0.7.2, License: GPL (>= 3)*