STA221H1 Lecture Notes - Lecture 30: Categorical Variable, Box Plot, Weight Loss

51 views2 pages

Document Summary

> # read weight loss program data le in r and save it to weight_loss for attachment. > weight_loss # take a look inside the data le. > # add your last name to the weight loss variable. > # obtain summary statistics for weight loss by type of diet. > favstats(lastname_weight_loss~diet) diet min q1 median q3 max mean sd n missing. 3 low_fat 2 7. 00 8. 0 8. 75 11 7. 5 2. 549510 10 0. > # obtain side-by-side boxplots of weight loss by type of diet. > boxplot(lastname_weight_loss~diet, main = "boxplots of weight loss by di erent diet", ylab = "weight loss (in pound)", xlab = "type of diet") > # make the category "low calories diet" the reference category. > # k = 3 levels; we need k-1 = 3-1 = 2 dummy variables. > # fit a regression model with a categorical explanatory variable.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents