STAT 503X Case Study 1: Restaurant Tipping

Similar documents
bivariate analysis: The statistical analysis of the relationship between two variables.

Business Statistics Probability

Announcement. Homework #2 due next Friday at 5pm. Midterm is in 2 weeks. It will cover everything through the end of next week (week 5).

Understandable Statistics

CHAPTER 3 Describing Relationships

Lesson 1: Distributions and Their Shapes

Describe what is meant by a placebo Contrast the double-blind procedure with the single-blind procedure Review the structure for organizing a memo

NORTH SOUTH UNIVERSITY TUTORIAL 2

Regression models, R solution day7

Still important ideas

Lab 4 (M13) Objective: This lab will give you more practice exploring the shape of data, and in particular in breaking the data into two groups.

Readings: Textbook readings: OpenStax - Chapters 1 13 (emphasis on Chapter 12) Online readings: Appendix D, E & F

Chapter 1: Exploring Data

Statistics is the science of collecting, organizing, presenting, analyzing, and interpreting data to assist in making effective decisions

Statistics is the science of collecting, organizing, presenting, analyzing, and interpreting data to assist in making effective decisions

AP Statistics. Semester One Review Part 1 Chapters 1-5

Unit 1 Exploring and Understanding Data

STATISTICS 8 CHAPTERS 1 TO 6, SAMPLE MULTIPLE CHOICE QUESTIONS

Logistic regression. Department of Statistics, University of South Carolina. Stat 205: Elementary Statistics for the Biological and Life Sciences

How to interpret scientific & statistical graphs

STATISTICS & PROBABILITY

Statistical reports Regression, 2010

Undertaking statistical analysis of

Describe what is meant by a placebo Contrast the double-blind procedure with the single-blind procedure Review the structure for organizing a memo

Lecture 12: more Chapter 5, Section 3 Relationships between Two Quantitative Variables; Regression

Students will understand the definition of mean, median, mode and standard deviation and be able to calculate these functions with given set of

UF#Stats#Club#STA#2023#Exam#1#Review#Packet# #Fall#2013#

Population. Sample. AP Statistics Notes for Chapter 1 Section 1.0 Making Sense of Data. Statistics: Data Analysis:

Unit 7 Comparisons and Relationships

Lesson 9 Presentation and Display of Quantitative Data

Regression so far... Lecture 22 - Logistic Regression. Odds. Recap of what you should know how to do... At this point we have covered: Sta102 / BME102

Political Science 15, Winter 2014 Final Review

Question 1(25= )

Still important ideas

Data Analysis in the Health Sciences. Final Exam 2010 EPIB 621

Assessing Agreement Between Methods Of Clinical Measurement

Preliminary Report on Simple Statistical Tests (t-tests and bivariate correlations)

Self-assessment test of prerequisite knowledge for Biostatistics III in R

Results & Statistics: Description and Correlation. I. Scales of Measurement A Review

Readings: Textbook readings: OpenStax - Chapters 1 11 Online readings: Appendix D, E & F Plous Chapters 10, 11, 12 and 14

Quantitative Methods in Computing Education Research (A brief overview tips and techniques)

Diurnal Pattern of Reaction Time: Statistical analysis

CHAPTER TWO REGRESSION

Chapter 3: Examining Relationships

CHAPTER ONE CORRELATION

Describe what is meant by a placebo Contrast the double-blind procedure with the single-blind procedure Review the structure for organizing a memo

Test 1C AP Statistics Name:

MULTIPLE LINEAR REGRESSION 24.1 INTRODUCTION AND OBJECTIVES OBJECTIVES

Biostatistics for Med Students. Lecture 1

Lecture Outline. Biost 517 Applied Biostatistics I. Purpose of Descriptive Statistics. Purpose of Descriptive Statistics

SUPPORT FOR SMOKERS Smoker s Diary

ANALYZING BIVARIATE DATA

Stats for Clinical Trials, Math 150 Jo Hardin Logistic Regression example: interaction & stepwise regression

Chapter 14. Inference for Regression Inference about the Model 14.1 Testing the Relationship Signi!cance Test Practice

Stepwise method Modern Model Selection Methods Quantile-Quantile plot and tests for normality

GPA vs. Hours of Sleep: A Simple Linear Regression Jacob Ushkurnis 12/16/2016

10/4/2007 MATH 171 Name: Dr. Lunsford Test Points Possible

14.1: Inference about the Model

Statistical Techniques. Masoud Mansoury and Anas Abulfaraj

STP 231 Example FINAL

Department of Statistics TEXAS A&M UNIVERSITY STAT 211. Instructor: Keith Hatfield

ANOVA in SPSS (Practical)

Economics 345 Applied Econometrics

CRITERIA FOR USE. A GRAPHICAL EXPLANATION OF BI-VARIATE (2 VARIABLE) REGRESSION ANALYSISSys

What you should know before you collect data. BAE 815 (Fall 2017) Dr. Zifei Liu

Psychology Research Process

Poisson regression. Dae-Jin Lee Basque Center for Applied Mathematics.

STP226 Brief Class Notes Instructor: Ela Jackiewicz

MINUTE TO WIN IT: NAMING THE PRESIDENTS OF THE UNITED STATES

Section 6: Analysing Relationships Between Variables

Lecture 6B: more Chapter 5, Section 3 Relationships between Two Quantitative Variables; Regression

Chapter 1. Picturing Distributions with Graphs

11/18/2013. Correlational Research. Correlational Designs. Why Use a Correlational Design? CORRELATIONAL RESEARCH STUDIES

Psychology Research Process

Probability and Statistics. Chapter 1

Introduction to Quantitative Methods (SR8511) Project Report

Introduction to Statistical Data Analysis I

Quantitative Data and Measurement. POLI 205 Doing Research in Politics. Fall 2015

Basic Biostatistics. Chapter 1. Content

On the purpose of testing:

1.4 - Linear Regression and MS Excel

Before we get started:

DO NOT OPEN THIS BOOKLET UNTIL YOU ARE TOLD TO DO SO

MMI 409 Spring 2009 Final Examination Gordon Bleil. 1. Is there a difference in depression as a function of group and drug?

12.1 Inference for Linear Regression. Introduction

Midterm STAT-UB.0003 Regression and Forecasting Models. I will not lie, cheat or steal to gain an academic advantage, or tolerate those who do.

EXECUTIVE SUMMARY DATA AND PROBLEM

REVIEW PROBLEMS FOR FIRST EXAM

Method Comparison Report Semi-Annual 1/5/2018

St. Teresa HSA Newsletter

10. LINEAR REGRESSION AND CORRELATION

Review and Wrap-up! ESP 178 Applied Research Methods Calvin Thigpen 3/14/17 Adapted from presentation by Prof. Susan Handy

2.4.1 STA-O Assessment 2

Normal Q Q. Residuals vs Fitted. Standardized residuals. Theoretical Quantiles. Fitted values. Scale Location 26. Residuals vs Leverage

Distributions and Samples. Clicker Question. Review

Chapter 4: More about Relationships between Two-Variables Review Sheet

SOME NOTES ON STATISTICAL INTERPRETATION

One-Way Independent ANOVA

Problem #1 Neurological signs and symptoms of ciguatera poisoning as the start of treatment and 2.5 hours after treatment with mannitol.

Chapter 3 CORRELATION AND REGRESSION

Transcription:

STAT 503X Case Study 1: Restaurant Tipping 1 Description Food server s tips in restaurants may be influenced by many factors including the nature of the restaurant, size of the party, table locations in the restaurant,... To make appropriate assignments (which tables the food server waits on) for the food servers, restaurant managers need to know what these factors are. For the sake of staff morale they must avoid either the substance or appearance of unfair treatment of the food servers, for whom tips are a major component of pay. In one restaurant, a food server recorded the following data on all customers they had served during a interval of two and a half months in early 1990. The restaurant, located in a suburban shopping mall, was one of a national chain and served a varied menu. In observance of local law the restaurant offered seating in a non-smoking sections to patrons who requested it. The data was assigned to those days and during those times when the food server was routinely assigned to work. The data available are: TOTBILL TIP SEX SMOKER DAY TIME SIZE Total bill, including tax, in dollars Tip in dollars Sex of person paying bill (0=male, 1=female) Smoker in party? (0=No, 1=Yes) 3=Thur, 4=Fri, 5=Sat, 6=Sun 0=day, 1=night Size of the party This is a great data set in many ways because it is clearly a pilot study. There should be no temptation to make inference from the data, and emphasis should be on poking around the data to formulate hypotheses, and design a careful study. 1

2 Suggested Approaches Approach Reason Type of questions addressed Data Restructuring Make new variable Tip Tip is usually referred to by percentage Rate from Tip/Total points, or as a rate. This also calibrates the variable according to the bill total and allows us to compare values across the other variables Make dummy variable for day of the week Summary statistics (marginal and conditional) Histograms (with different bin widths) such as size of the party. This is a categorical variable so it is not appropriate to treat it as an ordinal value. This is especially important for a regression analysis. extract location/scale information explore univariate distributions Pairwise Scatterplots explore bivariate distribution and (marginal and correlation structure conditional) Mosaic Plots explore multivariate (categorical) distributions Regression Determining the most important factors to tip rate What is the average tip rate at the restaurant?, Are tips higher on Saturdays than on Thursdays?, What is the average party size? Are there unusual patterns in the tipping behavior? (Outliers, distribution shape, quirky structures) Are there unusual patterns in the tipping behavior? Are there dependence relationships between the categorical variables? Which factors contribute to higher tips? We don t have to do anything really sophisticated with this data. It is almost entirely categorical except for tip and total bill. So we will make extensive use of conditional plots. 2

3 Actual Approaches 3.1 Summary Statistics Number of Observations = 244, Number of Variables = 7. TOTBILL TIP TIPRATE SEX SMOKER TIME SIZE Mean $19.78 $3.00 16.1% 0.36 0.38 0.72 2.57 SD $8.90 $1.38 6.1% 0.48 0.49 0.45 0.95 Table 1: Averages and Standard Deviations of Variables. The average bill is $20, average tip is $3 and average tip rate is $16. There are less females that pay the bill than males, less smokers than non-smokers, and more dining parties are in the restaurant at night than during the day. The average number of diners per party are 2.5. Tip Rate (Total Number) Thurs Fri Sat Sun Total 16.1 (62) 17.0 (19) 15.3 (87) 16.7 (76) Day 16.1 (61) 18.9 (7) 0 0 Night 16.0 (1) 15.9 (12) 15.3 (87) 16.7 (76) Table 2: Tip Rate (total number of diners) broken down by Day of the week and Time of Day. Over the days of the week Friday has very few diners, and Saturday has the most diners. There are no dining parties for lunch on the weekends. During the week there are more dining parties for lunch than dinner, but on weekends there are more dining parties for dinner. The lowest tip rate occurs on Saturday night. The highest is Friday lunch but there were only 7 dining parties then. Tip Rate (Total Number) Male Female Total Non-Smoker 16.1 (97) 15.7 (54) 15.9 (151) Smoker 15.3 (60) 18.2 (33) 16.3 (93) Total 15.8 (157) 16.6 (87) 16.1 (244) Table 3: Tip Rate (total number of diners) broken down by Sex and Smoker. The average tip rate paid by females is higher than that paid by males, non-smokers is lower than for smokers. But note that female smokers gave the highest average tip, and that male non-smokers paid a higher average tip rate than did female non-smokers. 3

Size of Party 1 2 3 4 5 6 Tip Rate (Total Number) 21.7 (4) 16.6 (156) 15.2 (38) 14.6 (37) 14.1 (5) 15.6 (4) Table 4: Tip Rate (total number of diners) broken down by Size of the Party. The most dining parties were of size 2, and there were very few dining parties of size 1, 5 or 6. Parties of size 2,3 and 4 show a decreasing trend in tip rate as size increases. Total Tip Tip Rate Sex Smoke Day Time Size Total 1.00 0.68-0.34-0.14 0.09 0.17 0.18 0.60 Tip 1.00 0.34-0.09 0.01 0.14 0.12 0.49 Tip Rate 1.00 0.07 0.03 0.01-0.03-0.14 Sex 1.00 0.00-0.23-0.21-0.09 Smoke 1.00-0.03 0.05-0.13 Day 1.00 0.87 0.17 Time 1.00 0.10 Size 1.00 Table 5: Correlations between variables: Tip and total bill are moderately highly correlated. There is a strong correlation between day and time. 3.2 Histograms of tips: varying bar width 3.2.1 $1 barwidth The shape of the data is skewed to the right, which says that there are more small tips, and fewer large tips. It is unimodal with a peak at $1-2 and gradually falling off to the right. This says that there are more groups of diners that pay tips in the range $1-4. Assuming there is a relationship between tip and total bill this suggests that the total bills may be mostly $15-60 roughly. It suggests the restaurant is not an expensive one. There are very few tips less than $1. 3.2.2 $0.50 barwidth It is no longer unimodal but bi- or even tri-modal. There is more to the tipping habits than implied by the large barwidth of $1. Also several very high tips are now apparent in the data. These are outliers, but from a waiting perspective these are the customers that you like! 3.2.3 $0.25 barwidth It is clearly multimodal in shape now. There are large peaks at $2,3,4,5 which suggests that patrons have a habit of rounding their tips to the nearest dollar amount. (Personal comment: I wonder if this behavior is different depending on whether the bill paid by credit card or cash.) 3.2.4 $0.10 barwidth This is a very fine resolution plot. There are now secondary peaks visible at $1.50,2.50,3.50 which suggests rounding not just to the nearest dollar amount but many people round to the nearest 50c. Also, it is clear that there are no tips recorded which are less than $1. 4

Figure 1: Histograms of Actual Tips with differing barwidth: $1, 50c, 33c, 25c, 20c, 10c. 5

3.3 Pairwise Scatterplots 3.3.1 Tip versus Total Bill There are more patrons that pay lower tips and lower total bills, and fewer and fewer spend at the high end, that is, it is skewed as we observed when looking at tips alone. There are lines of points visible at the tips level of $2,3,4 and to the keen eye also at the $1.50,2.50,3.50 amounts. This says that same as what we learned from the histograms that patrons tend to round their tips to the nearest dollar or half dollar amounts. There is also a lower bound of tip at $1. There is a linear relationship between tip and total bill, as you might expect. If you eyeball the the trend it looks to be about 15%. But there are a lot more points below the diagonal than above, that is, more patrons tip below the recommended level of 15% than above. Figure 2: Scatterplot of Total Tip vs Total Bill. More points in the bottom right indicate more cheap tippers than generous tippers. 3.3.2 Tip vs Total Bill by Sex of the Bill Payer (Note: The scale on both plots is the same, to allow for direct comparison.) There are more larger bills paid by males, but not too many. The larger tips/larger bills are paid by males. The eyeballed slope looks higher for the males than for the females. 6

(Note that we don t have any more information on the remaining members of the dining parties or even the size at this point, so we cannot tell whether the groups are dining together for business, as friends or for a romantic rendezvous. So we cannot infer whether a guy is trying to impress his girlfriend on their first date or a business colleague.) Figure 3: Scatterplot of Total Tip vs Total Bill by Sex. 3.3.3 Tip vs Total Bill by Sex of the Bill Payer and whether there was a Smoker in the Party or Not Smokers plots show a lot more variability than the non-smokers. There is a little relationships between the total bill and the tip for smoking parties! (What are they smoking?) Female non-smokers, with the exception of 3 low tippers are very consistent tippers as observed by the lack of variability. 3.4 Histograms of Tip Rate There are two unusually high tips. Observation 173 has a tip rate of 71%. This tip was paid by a male, tip of $5.15 for a $7.25 bill consumed by smoking party with 2 people, at dinner time on Sunday. Observation 179 has a tip rate of 42%, which was paid by a female for a tip of $4.00 on a $9.60 bill for items consumed by a smoking party of 2 at dinner time on Sunday. 7

Figure 4: Scatterplot of Total Tip vs Total Bill by Sex and Smoker. Figure 5: Histograms of Tip Rate: (left) all data, (middle) less than 35%, (right) log of tiprate. Tip rate looks skewed but it is mostly due to the two large tips. 8

3.5 Mosaic Plots A mosaic plot is a multivariate extension of the histogram, or to be more precise a spine plot. It is specifically designed to explore conditional relationships between multiple categorical variables. In a histogram the height of the bar corresponds to the count for that category. In a spine plot it is the width of the bar that corresponds to the category count. The mosaic plot begins by splitting the horizontal axis into bars with width corresponding to the first variable. The vertical axis is then used for the second variable, with the height of the bar corresponding to the relative count of the second variable conditional on the category of the first variable. This creates a mosaic of rectangles corresponding to the conditional count for each category of the second variable given the category of the first variable. Further variables can be introduced by interleaving them in the horizontal and vertical directions. The order of the entry into the mosaic plot changes the information that can be perceived. Figure 6 shows a mosaic plot of the variables Day of the Week and Sex of the Bill Payer. We can see the conditional distributions of Sex given the day of the week. On Thursday and Friday there are roughly equal numbers of males and females paying the bills but Saturday and Sunday see more males paying the bills. Figure 7 shows a mosaic plot of Smoking Party and Sex of the Bill Payer. There is no relationship between Smoking and Sex, as seen by the roughly equal rectangles across categories. It also displays a mosaic plot of Day of the Week vs Time of Day which shows that Saturday and Sunday there are no measurements taken during the day. Thursday there are very few evening measurements, and Friday there are similar numbers of day to evening measurements. Figure 6: Mosaic Plot of Day of the Week vs Sex of the Bill Payer. Figure 8 shows a mosaic plot of Size of the Party and Day of the Week and Sex of the Bill Payer. It can be seen that there are mostly parties of size 2 (something noticed in the summary statistics). The distribution of male to female bill payers replicates the trend noticed earlier only in parties of size 2. Otherwise in parties of size 1, the sex of the bill payer depends on the day of the week: mostly males on Friday, but mostly females on Thursday and Saturday, and no single diners on Sunday. In parties of size 3 Thursday saw roughly equal male and female bill payers, Friday mostly females, Saturday more males, but Sunday roughly equal. In parties of size 4 roughly equal males and females paid the bills on Thursday but more males paid the bills on Friday to Sunday. 9

Figure 7: Mosaic Plot of (Left) Smoking Party vs Sex of the Bill Payer, (Right) Day of the Week vs Time of Day. Figure 8: Mosaic Plot of Size of the Party vs Day of the Week vs Sex of the Bill Payer. 10

3.6 Regression A general linear model is fit with Tip Rate as the response variable against all other variables. Size of the Party is the most important predictor of tip rate, and Saturday is the next most important. This model explains just 4% (0.906-0.868) more of the variation than the null model containing an intercept alone. glm(formula = d.tips.full[, 9] ~ d.tips.full[, c(4, 5, 7, 8, 10, 11, 12)]) Deviance Residuals: Min 1Q Median 3Q Max -0.121623-0.031430-0.004193 0.028787 0.534639 Coefficients: Estimate Std. Error t value (Intercept) 0.214690 0.029889 7.183 d.tips.full[, c(4, 5, 7, 8, 10, 11, 12)]SEX 0.008543 0.008348 1.023 d.tips.full[, c(4, 5, 7, 8, 10, 11, 12)]SMOKER 0.003637 0.008497 0.428 d.tips.full[, c(4, 5, 7, 8, 10, 11, 12)]TIME -0.023371 0.026118-0.895 d.tips.full[, c(4, 5, 7, 8, 10, 11, 12)]SIZE -0.009625 0.004217-2.282 d.tips.full[, c(4, 5, 7, 8, 10, 11, 12)]Thurs -0.034848 0.027813-1.253 d.tips.full[, c(4, 5, 7, 8, 10, 11, 12)]Fri -0.016672 0.019023-0.876 d.tips.full[, c(4, 5, 7, 8, 10, 11, 12)]Sat -0.018445 0.009822-1.878 Pr(> t ) (Intercept) 8.86e-12 *** d.tips.full[, c(4, 5, 7, 8, 10, 11, 12)]SEX 0.3072 d.tips.full[, c(4, 5, 7, 8, 10, 11, 12)]SMOKER 0.6690 d.tips.full[, c(4, 5, 7, 8, 10, 11, 12)]TIME 0.3718 d.tips.full[, c(4, 5, 7, 8, 10, 11, 12)]SIZE 0.0234 * d.tips.full[, c(4, 5, 7, 8, 10, 11, 12)]Thurs 0.2115 d.tips.full[, c(4, 5, 7, 8, 10, 11, 12)]Fri 0.3817 d.tips.full[, c(4, 5, 7, 8, 10, 11, 12)]Sat 0.0616. --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05. 0.1 1 (Dispersion parameter for gaussian family taken to be 0.003679008) Null deviance: 0.90634 on 243 degrees of freedom Residual deviance: 0.86825 on 236 degrees of freedom AIC: -665.34 Fitting the model of tip rate against size of the party yields the relationship: ˆ T iprate = 0.1844 0.0092 Size This says that tip rate drops by roughly 1% from 18% for each additional dining party member. If Saturday is included into the model, then the tip rate for Saturday would be an additional 1% less than other days. 11

Call: glm(formula = d.tips.full[, 9] ~ d.tips.full[, 8]) Coefficients: (Intercept) d.tips.full[, 8] 0.184375-0.009173 Degrees of Freedom: 243 Total (i.e. Null); 242 Residual Null Deviance: 0.9063 Residual Deviance: 0.8878 AIC: -671.9 ------- Call: glm(formula = d.tips.full[,9] ~ d.tips.full[,8] + d.tips.full[,12]) Coefficients: (Intercept) d.tips.full[, 8] d.tips.full[, 12] 0.189564-0.009436-0.012659 Degrees of Freedom: 243 Total (i.e. Null); 241 Residual Null Deviance: 0.9063 Residual Deviance: 0.8789 AIC: -672.4 When the two extremely large tips are excluded Size of the Party is the only important variable and the model changes to become: ˆ T iprate = 0.1757 0.0071 Size Call: glm(formula = d.tips.full[d.tips.full[, 9] < 0.35, 9] ~ d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]) Deviance Residuals: Min 1Q Median 3Q Max -0.114676-0.030789-0.003702 0.031220 0.161127 Coefficients: Estimate (Intercept) 0.201070 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]SEX 0.007420 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]SMOKER -0.007741 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]TIME -0.025132 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]SIZE -0.006871 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]Thurs -0.024250 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]Fri 0.001779 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]Sat -0.004140 Std. Error (Intercept) 0.023071 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]SEX 0.006476 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]SMOKER 0.006622 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]TIME 0.020139 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]SIZE 0.003259 12

d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]Thurs 0.021467 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]Fri 0.014756 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]Sat 0.007672 t value (Intercept) 8.715 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]SEX 1.146 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]SMOKER -1.169 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]TIME -1.248 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]SIZE -2.108 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]Thurs -1.130 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]Fri 0.121 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]Sat -0.540 Pr(> t ) (Intercept) 5.41e-16 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]SEX 0.2531 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]SMOKER 0.2436 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]TIME 0.2133 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]SIZE 0.0361 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]Thurs 0.2598 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]Fri 0.9041 d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]Sat 0.5900 (Intercept) *** d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]SEX d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]SMOKER d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]TIME d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]SIZE * d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]Thurs d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]Fri d.tips.full[d.tips.full[, 9] < 0.35, c(4, 5, 7, 8, 10, 11, 12)]Sat --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05. 0.1 1 (Dispersion parameter for gaussian family taken to be 0.002187294) Null deviance: 0.53620 on 241 degrees of freedom Residual deviance: 0.51183 on 234 degrees of freedom AIC: -785.64 Number of Fisher Scoring iterations: 2 -------------------------- Call: glm(formula = d.tips.full[d.tips.full[,9]<0.35,9]~d.tips.full[d.tips.full[,9]<0.35,8]) Coefficients: (Intercept) 0.17573 d.tips.full[d.tips.full[, 9] < 0.35, 8] -0.00709 13

Degrees of Freedom: 241 Total (i.e. Null); 240 Residual Null Deviance: 0.5362 Residual Deviance: 0.5252 AIC: -791.4 Using log(tip rate) the results are effectively the same, although its trickier to interpret the coefficients. Figure 9: Scatterplot of Tip Rate vs Size of Party, with least squares fit overlaid. Earlier we noticed a relationship between sex of the bill payer, smoking or not in relation to the tip and total bill. We can use regression to explore this relationship. Here we fit a model of tip rate against these two variables including an interaction term (with the two extremely large tips excluded). Call: glm(formula = d.tips.full[d.tips.full[, 9] < 0.35, 9] ~ d.tips.full[d.tips.full[, 9] < 0.35, 4] * d.tips.full[d.tips.full[, 9] < 0.35, 5] + d.tips.full[d.tips.full[, 9] < 0.35, 8]) Deviance Residuals: Min 1Q Median 3Q Max -0.113227-0.026526-0.002413 0.032607 0.147479 Coefficients: Estimate (Intercept) 0.179328 d.tips.full[d.tips.full[, 9] < 0.35, 4] -0.004565 14

d.tips.full[d.tips.full[, 9] < 0.35, 5] -0.018744 d.tips.full[d.tips.full[, 9] < 0.35, 8] -0.006882 d.tips.full[d.tips.full[, 9] < 0.35, 4]:d.tips.full[d.tips.full[, 9] < 0.35, 5] 0.034287 Std. Error (Intercept) 0.009747 d.tips.full[d.tips.full[, 9] < 0.35, 4] 0.007836 d.tips.full[d.tips.full[, 9] < 0.35, 5] 0.007638 d.tips.full[d.tips.full[, 9] < 0.35, 8] 0.003153 d.tips.full[d.tips.full[, 9] < 0.35, 4]:d.tips.full[d.tips.full[, 9] < 0.35, 5] 0.012801 t value (Intercept) 18.398 d.tips.full[d.tips.full[, 9] < 0.35, 4] -0.583 d.tips.full[d.tips.full[, 9] < 0.35, 5] -2.454 d.tips.full[d.tips.full[, 9] < 0.35, 8] -2.182 d.tips.full[d.tips.full[, 9] < 0.35, 4]:d.tips.full[d.tips.full[, 9] < 0.35, 5] 2.678 Pr(> t ) (Intercept) < 2e-16 d.tips.full[d.tips.full[, 9] < 0.35, 4] 0.56073 d.tips.full[d.tips.full[, 9] < 0.35, 5] 0.01484 d.tips.full[d.tips.full[, 9] < 0.35, 8] 0.03006 d.tips.full[d.tips.full[, 9] < 0.35, 4]:d.tips.full[d.tips.full[, 9] < 0.35, 5] 0.00792 (Intercept) *** d.tips.full[d.tips.full[, 9] < 0.35, 4] d.tips.full[d.tips.full[, 9] < 0.35, 5] * d.tips.full[d.tips.full[, 9] < 0.35, 8] * d.tips.full[d.tips.full[, 9] < 0.35, 4]:d.tips.full[d.tips.full[, 9] < 0.35, 5] ** --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05. 0.1 1 (Dispersion parameter for gaussian family taken to be 0.002124999) Null deviance: 0.53620 on 241 degrees of freedom Residual deviance: 0.50362 on 237 degrees of freedom AIC: -795.55 Number of Fisher Scoring iterations: 2 Whats interesting is that when the interaction between sex and smoke is included in the model both variables become important predictors of the tip rate, whereas they are not important when the interaction term is excluded. Size of the party remains important as well. Then the model becomes: ˆ T iprate = 0.1793 0.0069 Size 0.0046 Sex 0.0187 Smoke + 0.0343 Sex Smoke This model says that from a base tip rate of 18% each additional party member reduces the rate 0.7%, if a female pays the bill then the rate is reduced a further 0.5%, if it is a smoking party then the rate is reduced a further 1.9% and if it is a female who pays the bill of a smoking party then the rate is increased by 3%. This relationship roughly matches the summary statistics computed earlier. 15

3.7 What else could/should we have done? 16

4 Summary of Findings There is a tendency to give cheap tips rather than generous tips relative to the total bill. There is a tendency to round the tip to the nearest dollar, and to a lesser extent to the nearest 50c. There is much more variation in the tips given by smoking parties than non-smoking parties. And the female non-smokers are very consistent tippers. There are a couple very large tips. The largest, 71%, was given by a male smoker on Saturday night in a party of size 2. The next largest, 42%, was given by a female smoker on Saturday night in a party of size 2. Depending on the day of the week there appears to be increasingly more males paying the bill towards the weekend days but this is true only for the parties of size 2. Size of the party appears to be the most important factor in predicting tip rate, with a decrease in the tip rate as the size of the party increases. The actual regression model is T iprate ˆ = 0.1757 0.0071 Size which says that for each additional person in the dining party tip rate decreases a little less than a percentage point from 17.5%. Our data is really only adequate to measure this for dining parties of size 2, 3 and 4. 17

References [Bryant and Smith, 1995] Bryant, P. G. and Smith, M. A. (1995). Practical Data Analysis: Case Studies in Business Statistics. Richard D. Irwin Publishing, Homewood, IL. 18