Completely Randomized Design
In a completely randomized design, there is only one primary factor under consideration in the experiment. The test subjects are assigned to treatment levels of the primary factor at random.
A fast food franchise is test marketing 3 new menu items. To find out if they the same popularity, 18 franchisee restaurants are randomly chosen for participation in the study. In accordance with the completely randomized design, 6 of the restaurants are randomly chosen to test market the first new menu item, another 6 for the second menu item, and the remaining 6 for the last menu item.
Suppose the following table represents the sales figures of the 3 new menu items in the 18 restaurants after a week of test marketing. At .05 level of significance, test whether the mean sales volume for the 3 new menu items are all equal.
The solution consists of the following steps:
- Copy and paste the sales figure above into a table file named "fastfood-1.txt" with a text editor.
- Load the file into a data frame named df1 with the read.table function. As the first line in the file contains the column names, we set the header argument as TRUE.
- Concatenate the data rows of df1 into a single vector r .
- Assign new variables for the treatment levels and number of observations.
- Create a vector of treatment factors that corresponds to each element of r in step 3 with the gl function.
- Apply the function aov to a formula that describes the response r by the treatment factor tm.
- Print out the ANOVA table with the summary function.
Since the p-value of 0.11 is greater than the .05 significance level, we do not reject the null hypothesis that the mean sales volume of the new menu items are all equal.
Create the response data in step 3 above along vertical columns instead of horizontal rows. Adjust the factor levels in step 5 accordingly.