The make_1way_data, make_1way_rb_data, make_2way_data and make_2way_rb_data functions generate independent or randomised block (rb) design data of one-way or two-way designs.

make_2way_rb_data(Group1_means, Group2_means, Num_exp, Exp_SD, Residual_SD)



a vector with means of each level of the first fixed factor (FixFac_X1) measured within Group 1.


only for make_2way_data and make_2way_rb_data: a vector with mean(s) of each level of FactorX2 measured within Group 2.


a single numeric value indicating the number of independent measurements, i.e. levels within the random factor RandFac.


a single numeric value indicating the standard deviation (SD) between experiment, i.e. within RandFac.


a single numeric value indicating residual SD in the model.


This function produces a data.frame object containing simulated data.


Random variates from the normal distribution based on user provided mean and SD provided are generated. For independent designs, the Residual_SD argument is used to set expected residual SD from the linear model. Exp_SD is used to set experiment-to-experiment SD, that will be assigned to the random factor (RandFac) for rb designs.

Num_exp sets the number of independent measurements per group.

For one-way designs, the user provides Group_means as a vector. Number of levels are recognised based on number of means. For two-way designs, two vectors are to be provided by the user containing means of levels of a second factor. Number of means in both vectors should be the same. These functions can only handle balanced designs, i.e. same number of observations in all groups.

The output is a data frame with one or two columns denoting the fixed factor with levels that match the number of means entered. For rb data, the column for RandFac denotes levels of the blocking factor. The quantitative response variables are in the numeric Values column.


#Basic usage with two levels within FactorX2, 
#20 experiments with inter-experiment SD 20, and residual SD 15

two_rb_tab <- make_2way_rb_data(c(100, 20), c(200, 300), 20, 20, 15)

#> 'data.frame':	80 obs. of  4 variables:
#>  $ RandFac : Factor w/ 20 levels "Exp_1","Exp_10",..: 1 1 1 1 12 12 12 12 14 14 ...
#>  $ FixFac_1: Factor w/ 2 levels "Fx1Lev_1","Fx1Lev_2": 1 1 2 2 1 1 2 2 1 1 ...
#>  $ FixFac_2: Factor w/ 2 levels "Fx2Lev_1","Fx2Lev_2": 1 2 1 2 1 2 1 2 1 2 ...
#>  $ Values  : num  95.6 12.5 219.9 310 133.9 ...
#>   RandFac FixFac_1 FixFac_2    Values
#> 1   Exp_1 Fx1Lev_1 Fx2Lev_1  95.58239
#> 2   Exp_1 Fx1Lev_1 Fx2Lev_2  12.46678
#> 3   Exp_1 Fx1Lev_2 Fx2Lev_1 219.91286
#> 4   Exp_1 Fx1Lev_2 Fx2Lev_2 310.04441
#> 5   Exp_2 Fx1Lev_1 Fx2Lev_1 133.89097
#> 6   Exp_2 Fx1Lev_1 Fx2Lev_2  62.19375