In: Statistics and Probability
Detailed interviews were conducted with over 1,000 street
vendors in the city of Puebla, Mexico, in order to study the
factors influencing vendors’ incomes. Vendors were defined as
individuals working in the street and included vendors with carts
and stands on wheels and excluded beggars, drug dealers, and
prostitutes. The researchers collected data on gender, age, hours
worked per day, annual earnings, and education level. These data
are saved in STREETVEN file. Consider an interaction model ? = ?0 +
?1?1 + ?2?2 + ?3?1?2 + ? for the vendor’s mean annual earning ?(?).
?ℎ??? ? = ?????? ????????,?1 = ??? ??? ?2 = ℎ???? ?????? ???
???.
a. Use statistical software R to fit the interaction model and
provide the summary of the model. Also write least squares
prediction equation. b. What is the estimated slope relating annual
earnings (y) to age (x1) when number of hours worked (x2) is 10?
Interpret the result. c. What is the estimated slope relating
annual earnings (y) to hours worked (x2) when age (x1) is 40?
Interpret the result. d. Conduct a hypothesis test to decide
whether age (x1) and hours worked (x2) interact. Write your
conclusion.
PLEASE PROVIDE THE CODE FOR R STUDIO or screenshot
VenNum Earnings Age
Hours
21 2841 29 12
53 1876 21 8
60 2934 62 10
184 1552 18 10
263 3065 40 11
281 3670 50 11
354 2005 65 5
401 3215 44 8
515 1930 17 8
633 2010 70 6
677 3111 20 9
710 2882 29 9
800 1683 15 5
914 1817 14 7
997 4066 33 12
(a) using R the least Square interaction model is found to be:
y= 1041.894-13.238*x1 + 103.306*x2 +3.621*x1*x2
(b) the estimated slope of y to x1 when x2 is constant = 13.238 . This means that for an unit increase in age, the earnings decreases by 13.238 ( since the sign is negative, earnings decrease)
(c) The estimated slope of y to x2 when x1 is constant = 103.306 . This means that for an unit increase in hours , the earnings increases by 103.306 ( since sign is positive, earnings increase)
(d) from the R output, we see that pvalue corresponding to interaction is 0.366 > .05 . Hence x1 and x2 don't interact.
R codes and output :
y=c(2841,1876,2934,1552,3065,3670,2005,3215,1930,2010,3111,2882,1683,1817,4066)
x1=c(29,21,62,18,40,50,65,44,17,70,20,29,15,14,33)
x2=c(12,8,10,10,11,11,5,8,8,6,9,9,5,7,12)
f=lm(y~x1+x2+(x1*x2))
summary(f)