make_2way_rb_data functions generate independent or randomised block (rb) design data of one-way or two-way designs.
make_1way_data(Group_means, Num_obs, Residual_SD)
a vector with means of each level of the first fixed factor (FixFac_X1) measured within Group 1.
a single numeric value indicating the number of independent measurements, i.e. levels within the random factor Experiment.
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 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 three levels within Factor_X, #20 observations in each group, with residual SD 15 one_independent_tab <- make_1way_data(c(350, 250, 100), 15, 20) str(one_independent_tab) #> 'data.frame': 45 obs. of 2 variables: #> $ FixFac_1: Factor w/ 3 levels "Lev_1","Lev_2",..: 1 2 3 1 2 3 1 2 3 1 ... #> $ Values : num 343.9 263.8 80.2 299.9 282.5 ... head(one_independent_tab) #> FixFac_1 Values #> 1 Lev_1 343.88871 #> 2 Lev_2 263.76850 #> 3 Lev_3 80.23833 #> 4 Lev_1 299.92442 #> 5 Lev_2 282.50235 #> 6 Lev_3 133.80370