# NOT RUN {
data(imaging)
imaging.lm = lm(FilteredSignal~BehavioralScore*Condition, data=imaging)
summary(imaging.lm)
plot(imaging$BehavioralScore, imaging$FilteredSignal, type = "n",
xlim = c(-30, 40), ylim = c(0, 80))
semantics = imaging[imaging$Condition == "semantics",]
irregulars = imaging[imaging$Condition == "irregulars",]
points(semantics$BehavioralScore, semantics$FilteredSignal, col = "black")
points(irregulars$BehavioralScore, irregulars$FilteredSignal, col = "darkgrey")
abline(lm(FilteredSignal ~ BehavioralScore, data = semantics), col = 'black')
abline(lm(FilteredSignal ~ BehavioralScore, data = irregulars),
col = 'darkgrey')
# model criticism
plot(imaging.lm)
outliers = c(1, 19) # given Cook's distance, or perhaps only
outliers = 1 # the outlier in the semantics subset
imaging.lm = lm(FilteredSignal ~ BehavioralScore * Condition,
data = imaging[-outliers, ])
summary(imaging.lm)
# }
Run the code above in your browser using DataLab