Chance of Yes
Whether a customer buys (1) or walks away (0) depends on the price shown. x holds the prices of past cases and y what happened. Model the outcome with a logistic regression that has an intercept, and return the chance of a 1 at the price new_x. Answers within 0.01% are accepted.
Example 1
x [-3,-2,-2,-1,-1,0,0,1,1,2,2,3,-1.5,0.5,1.5]
y [0,0,0,0,1,0,1,1,0,1,1,1,0,1,1]
new_x 0.0
returns 0.5452627088378293
Around x = 0 the two answers are about equally common in this data.
Constraints
15 <= len(x) <= 60- The 0 and 1 cases overlap along
x
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More statsmodels problems
- Does One Change the OtherMedium
- Model for CountsMedium
- Odds of YesMedium
- Pattern in the LeftoversMedium
- Point That Pulls HardestMedium
- Tangled PredictorsMedium
- Top of the CurveMedium
- Trust Some Points MoreMedium