Worksheet 6

Published

February 9, 2025

Packages

library(tidyverse)
library(marginaleffects)

Chocolate cake

In an experiment on the preparation of chocolate cakes, three recipes for preparing the batter were compared. Recipes R1 and R2 differed in that the chocolate was added at 40C and 60C, respectively, while recipe R3 contained extra sugar. In addition, six different baking temperatures were tested: these ranged in 10C steps from 175C to 225C. (For those more used to baking in Fahrenheit, this is between about 350F and 450F.) Several measurements were made on the cakes. The one shown here is the breaking angle. One half of a slab of cake is held fixed, while the other half is pivoted about the middle until breakage occurs. The angle through which the moving half has revolved is read on a circular scale. Since breakage is gradual, the reading tends to have a subjective element. (A higher breaking angle is considered better.)

The data are in http://ritsokiguess.site/datafiles/choccake.csv. There is an additional column batch that you can ignore.

  1. Read in and display (some of) the data.
  1. Obtain a suitable boxplot of these data.
  1. Regardless of any misgivings you may have about your boxplot, fit an (otherwise) appropriate analysis of variance model, and display the results.
  1. What do you conclude from the \(F\)-test in the above analysis, in the context of the data?
  1. Can you improve your model of the previous part? If so, do so; if not, explain briefly why not.
  1. Obtain an analysis of the simple effects of recipe at temperature 175C.
  1. Obtain an analysis of the simple effects of recipe at temperature 225C.
  1. Compare the results of the previous two parts. Considering the results of your previous work, explain briefly why this not a surprise.

Drug and electroshock and solving simple tasks

64 subjects were given some simple tasks to do, and the number of tasks completed in 10 minutes was recorded. This is shown in the column response in our data. Before attempting the tasks, each subject was randomly assigned to either receive or not receive a drug (in xdrug), and also to receive or not receive electroshock therapy (in xshock). The researchers were interested in whether either the drug or the electroshock or the combination of both affected the number of tasks the subject could solve. (The subjects were all fully informed of the risks, and agreed to sign consent forms.) The data are in http://ritsokiguess.site/datafiles/drugshock.csv.

  1. Read in and display (some of) the data.
  1. Draw a suitable graph of all three variables. Here, and in the next question, put drug on the \(x\) axis.
  1. Draw an interaction plot for these data.
  1. Based on your two graphs, do you expect to see an interaction, and do you expect it to be significant? Explain briefly.
  1. Run a suitable ANOVA and display the results. Were your suspicions confirmed?
  1. Why is a simple effects analysis appropriate here? Carry out a simple effects analysis of xshock for each level of xdrug, stating your conclusions in the context of the data.
  1. Why is there no value in running Tukey as a followup to any of your simple effects? Explain briefly.