Answered step by step
Verified Expert Solution
Question
1 Approved Answer
It seems like taxi's with CMT displays had greater tip percentages after February 9 , 2 0 1 1 , than they did before. This
It seems like taxi's with CMT displays had greater tip percentages after February than they did before. This might be because CMT increased their default tip suggestions, but it also might be the case that tip percentages just increase over time. One way to try to understand which of these two hypothesis is correct is to use taxi's with VTS displays as a comparison group. To do that, use the entire taxi dataframe, instead of just CMTtaxi, and run the OLS regression in which the depenent variable is tippercentage and the independent variables are CMT postfeb, and CMTxpost. The dummy variable CMT will control for differences between CMT and VTS The dummy variable postfeb will control for differences in the preperiod and the postperiod. Finally, the dummy variable CMTxpost will be the variable of interest the difference between CMT in the postperiod and VTS in the preperiod while controlling CMTVTS differences and prepost differences. To run an OLS regression with more than one independent variable, use a list of column names when defining your X variable.
If the average fare amount is $ how much does increasing default tip suggestions increase the predicted dollar value of a tip on the average fare? Store your answer in the variable predictedtipincrease. Remember to look at the units of the variable tippercentage in the output of taxi.head above in order to set the interpret the coefficients correctly. My code: import statsmodels.api as sm
# OLS Regression
x smaddconstanttaxiCMT 'postfeb', 'CMTxpost'
y taxitippercentage'
model smOLSy x
results model.fit
averagefareamount
predictedtipincrease results.paramsCMTxpost averagefareamount
printpredictedtipincrease
# Logistic Regression
xlogit smaddconstanttaxiCMT 'postfeb', 'CMTxpost'
ylogit taxidefaultoption'
logitmodel smLogitylogit xlogit
resultslogit logitmodel.fit
marginaleffects resultslogitgetmargeffat'mean'
effectondefaultselection marginaleffects.summarytables
pvalue resultslogitpvalues
alpha
statsig "yes" if pvalue alpha else no
printeffectondefaultselection
printstatsig error code: You have failed this test due to an error. The traceback has been removed because it may contain hidden tests. This is the exception that was thrown:
AssertionError: Problem : Your answer for predictedtipincrease does not match the official answer.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started