makeData: Population parameter specification for a power analysis

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/makeData.R

Description

The function allows the analyst to prepare an idealized data set which exactly matches selected point values, and incorporates uncertainty in these values in terms of sample size.

Usage

1
2
makeData(mu1, sd1, mu2 = NULL, sd2 = NULL, nPerGrp,
	pcntOut = 0, sdOutMult = 2, rnd.seed = NULL, showPlot = TRUE)

Arguments

mu1

the mean for the first (or only) population.

sd1

the standard deviation for the main part of the first population, excluding outliers.

mu2

the mean for the second population; NULL if only one population is involved.

sd2

the standard deviation for the main part of the second population; NULL if only one population is involved.

nPerGrp

sample size per group; large sample size reflects a high degree of precision in the values for the means and standard deviations.

pcntOut

the percentage of outliers in each population.

sdOutMult

the standard deviation of the outliers as a multiple of the standard deviation of the main part of the population.

rnd.seed

a seed for the random number generator, used to obtain reproducible samples if required.

showPlot

if TRUE, displays the results as a plot (see Details).

Details

The arguments to this function provide a framework to specify the hypothesized values of the parameters of the populations under study, while the sample size is chosen to reflect the confidence in the values specified.

The function produces idealized samples, ie. samples which exactly match the specified means and standard deviations. If showPlot = TRUE, the results are displayed as a plot:

makeData.jpg

Histograms: actual sample values; red dashed line: distribution of the outliers; blue dashed line: distribution of the non-outliers; black line: combined distribution.

These idealized samples are passed to BESTmcmc, which generates a series of sets of credible values for the parameters, including the normality parameter, taking account of correlations among them.

The sets of credible parameter values which constitute the BESTmcmc output are used by BESTpower to simulate new data sets which might arise during a subsequent experiment.

Value

A list with two components:

y1

A vector of simulated values for the first (or only) group.

y2

A vector of simulated values for the second group or NULL.

Author(s)

John Kruschke

References

Kruschke, J. K. 2013. Bayesian estimation supersedes the t test. Journal of Experimental Psychology: General 142(2):573-603. doi: 10.1037/a0029146

See Also

BESTpower for examples.

Examples

1
## See examples for BESTpower.

BEST documentation built on Oct. 13, 2021, 9:08 a.m.