Answered step by step
Verified Expert Solution
Link Copied!

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 9,2011, 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 CMT_taxi, and run the OLS regression in which the depenent variable is tip_percentage and the independent variables are CMT, post_feb, and CMTxpost. The dummy variable CMT will control for differences between CMT and VTS. The dummy variable post_feb will control for differences in the pre-period and the post-period. Finally, the dummy variable CMTxpost will be the variable of interest-- the difference between CMT in the post-period and VTS in the pre-period while controlling CMT-VTS differences and pre-post 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 $47, 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 predicted_tip_increase. Remember to look at the units of the variable tip_percentage (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 = sm.add_constant(taxi[['CMT', 'post_feb', 'CMTxpost']])
y = taxi['tip_percentage']
model = sm.OLS(y, x)
results = model.fit()
average_fare_amount =47
predicted_tip_increase = results.params['CMTxpost']* average_fare_amount
print(predicted_tip_increase)
# Logistic Regression
x_logit = sm.add_constant(taxi[['CMT', 'post_feb', 'CMTxpost']])
y_logit = taxi['default_option']
logit_model = sm.Logit(y_logit, x_logit)
results_logit = logit_model.fit()
marginal_effects = results_logit.get_margeff(at='mean')
effect_on_default_selection = marginal_effects.summary().tables[1][1][0]
p_value = results_logit.pvalues[-1]
alpha =0.05
stat_sig = "yes" if p_value < alpha else "no"
print(effect_on_default_selection)
print(stat_sig) 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 3.3: Your answer for predicted_tip_increase does not match the official answer.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

1. What are the peculiarities of viruses ?

Answered: 1 week ago

Question

Describe the menstrual cycle in a woman.

Answered: 1 week ago