Skip to content
EDA
  • AI Chat
  • Code
  • Report
  • Spinner
    # Start coding here...
    
    library(readr)
    Menu <- c(rep("Menu 1",6),rep("Menu 2",6),rep("Menu 3",6))
    Sales <- c(22,42,44,52,45,37,52,33,8,47,43,32,16,24,19,18,34,39)
    data2 <- data.frame(Menu, Sales)
    data2
    #Convert treatment into factor
    Treatment = as.factor(data2$Menu)
    Treatment
    results <- lm(Sales ~ Menu, data2)
    anova(results)
    Treatment = as.factor(data2$Menu)
    results = aov(Sales~Treatment,data2)
    summary(results)

    Model Checking

    #find residual
    residuals <- resid(results)
    residuals
    #Predicted
    predicted= predict(results)
    predicted
    library(ggpubr)
    ggqqplot(residuals)
    #Shapiro
    shapiro.test(residuals)
    library(car)
    durbinWatsonTest(residuals)