Question: DVD The next question uses information extracted from the dataset described below. Description The data contain information on a sample of 2 0 , 0

DVD
The next question uses information extracted from the dataset described below.
Description
The data contain information on a sample of 20,000 customers who received an "instant coupon." The value of the coupon was varied between $1 and $5 and randomly assigned to the selected customers.
Our interest is in estimating the effect of the coupon on purchase of a newly released DVD. We will also investigate the role of two additional variables: purch is a measure of frequency of purchase and last is a measure of the recency of the last purchase by a customer. These measures are often used in practice to predict response rates.
Customers who received the coupon and purchased the DVD are identified in the data by the variable buy. Because the variable we want to predict is binary (buy =
pon ana purchased ine
yes if the customer purchased the DVD and buy = no if she did not), logistic regression is appropriate.
Variables
buy = yes if the customer purchased the DVD and no if she did not
coupon = value of an "instant coupon" in dollars. the value varies between $1 and $5
of the lans the walte vards bet
purch = number of purchases by the customer in the past year
last = days since the last purchase by the customer
training =70/30 split, 1 for training sample, 0 for validation sample.
There are 200 files in the "data/dvd-csv" directory.
Some have only one row of data and some have more rows. Use the pandas read_cs function in a loop to load all the files. In the loop, also track the values for buy, coupon, purch, and last. After the loop completes, replace the counts in stats with the mean of coupon, purch, and last. For the buy variable calculate the proportion of cases with a "yes" value and assign that value to stats ["buy"].

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!