# Obesity and McDonald's # This is an interesting data set sho9wing the relationship between obesity rates and # the number of McDonalds' restaurants per 100,000 population. # Variable names are State, McDRate, and ObeseRate #Data from http://www.csun.edu/~sg4002/research/mcdonalds_by_state.htm # and # http://calorielab.com/news/2010/06/28/fattest-states-2010/ data <- read.table("http://www.uvm.edu/~dhowell/methods8/DataFiles/obese.dat ", header = TRUE) attach(data) mod1 <- lm(ObeseRate~McDRate) summary(mod1) plot(ObeseRate~McDRate, main = "Obesity as Function of McDonald's/100,000") abline(mod1) correl <- cor(ObeseRate, McDRate) text(6, 33, substitute (r == ".274")) # Alternative approach when you don't know numerical value in advance bquote(correl == .(correl)) text(3.5, 30, bquote(correl == .(correl)) )