View source: R/make_2way_rb_data.R
make_2way_rb_data | R Documentation |
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)
Group1_means |
a vector with means of each level of the first fixed factor (FixFac_X1) measured within Group 1. |
Group2_means |
only for |
Num_exp |
a single numeric value indicating the number of independent measurements, i.e. levels within the random factor RandFac. |
Exp_SD |
a single numeric value indicating the standard deviation (SD) between experiment, i.e. within RandFac. |
Residual_SD |
a single numeric value indicating residual SD in the model. |
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.
This function produces a data.frame
object containing simulated data.
#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)
str(two_rb_tab)
head(two_rb_tab)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.