This function simulates data from a family of experiments. The parameter Exp determines the number of experiments in the family. The function simulates data from one of four distributions and uses the data to construct two of groups of equal size (GroupSize). The distribution for one of the groups corresponds to the control and is based on the given mean and spread, the distribution for the other group corresponds to the treatment group and is based on the mean+diff and the spread plus any variance adjustment requested (determined by the parameter StdAdj). The data from each experiment is analysed separately to estimate three non-parametric effect sizes: the Cliff's d and the probability of superiority referred to as phat and their variances. Parametric effect sizes Cohen's d (also known as the standarized means difference, SMD) and the small sample size adjusted standardized mean difference g are also calculated together with their variances. The effect sizes are then meta-analysed using various methods: the simple average of the effect size and the variance weighted averages (using the exact and approximate normal variance and the weighted and unweighted standardized mean difference). The function uses the metafor package for formal meta-analysis, and the specific method of formal meta-analysis used is determined by the MAMethod. All tests of significance are done at the 0.05 level. If the parameter returnES is TRUE, the function returns the effect sizes for each experiment in the family, otherwise it returns the meta-analysis results.
mean: the value used for the mean of control group in the simulated data. It can be any real number including zero.
sd: the value used for the spread of the control group and the spread of the treatment group in the simulated data. The value must be a real value greater than 0.
diff: mean+diff is the value used for the mean of the treatment group. It can be zero.
GroupSize: is the size of each of the 2 groups comprising one experiment. Groupsize should be an integer of 4 or more
Exp: is the number of experiments being simulated. Exp should be an integer of 2 or more. It defaults to 5.
type: specifies the distribution being simulated. The permitted values are "n" for the normal distribution, "l" for the lognormal distribution, "g" for the gamma distribution and "lap" for the Laplace distribution. The parameter defaults to "n".
StdAdj: specifies a level used to adjust the treatment variance. It allows heterogeneity to be modelled. It defaults to zero meaning no variance heterogeneity is introduced.
alpha: the Type 1 error rate level use for statistical tests.
seed: specifies the seed to be used to initiate the simulation, so the simulation is repeatable. It defauls to 123.
StdExp: defines whether any additional heterogeneity is introduced between families. The value (set to 0 or 0.5 for our simulations) is used when we generate a deviation to be added to the control mean (control rate for gamma data) for each family. The deviation is generated from a Normal distribution with mean 0 and standard deviation=0.5. If StdExp=0 we do not add any deviations to the mean.
MAMethod: the meta-analysis method needed for the call to the metafor package rma algorithm
returnES: Determines the format of the output. It defaults to FALSE which causes the function to output the meta-analysis results for the family of experiments. If set to TRUE it returns the effect sizes for each experiment.
AlwaysTwoSidedTests: If FALSE the function performs one-sided tests if diff!=0, and two-sided tests if diff=0. If set to TRUE the function alsways does two-sided tests.
Returns
Depending on the value of the returnES parameter, the function either returns the effect sizes for each experiment or the aggregated results for the family