factorial experiments factors levels linear models with continuous responses and categorical explanatory variables often arise in factorial experiments these are controlled statistical experiments in which the aim is to assess how response variable is affected by one or more factors tested at several levels typical example is an agricultural experiment where one wishes to investigate how the yield of food crop depends on factors such as locationpesticideand fertilizer example (crop yieldthe data in table lists the yield of food crop for four different crop treatments ( strengths of fertilizeron four different blocks (plotstable crop yield for different treatments and blocks treatment block the corresponding data framegiven in table has rows and columnsone column for the crop yield (the response variable)one column for the treatmentwith levels and one column for the blockalso with levels the values and have no quantitative meaning (it does not make sense to take their averagefor example-they merely identify the category of the treatment or block table crop yield data organized as data frame in standard format yield treatment block indicator feature in generalsuppose there are factor (categoricalvariables ur where the jth factor has mutually exclusive levelsdenoted by in order to include these categorical variables in linear modela common approach is to introduce an indicator feature jk { kfor each factor at level thusx jk if the value of factor is and otherwise since { it suffices to consider only of these indicator features for each factor (this prevents the model matrix from being rank deficientfor single response ythe feature vector xis thus row vector of binary variables