Logistic Regression
Logistic Regression
Time Series
Mansour Ahmady Phoulady Predicting Cafe Visitation with Logistic Regression for TimeJune
Series
18, 2024 1/7
Introduction
Mansour Ahmady Phoulady Predicting Cafe Visitation with Logistic Regression for TimeJune
Series
18, 2024 2/7
Scenario and Data
Scenario: Predict whether a customer will visit a cafe on the 8th day
based on their visitation record over the previous week.
Data:
Day 1: Visited (1)
Day 2: Did not visit (0)
Day 3: Visited (1)
Day 4: Did not visit (0)
Day 5: Visited (1)
Day 6: Visited (1)
Day 7: Did not visit (0)
Mansour Ahmady Phoulady Predicting Cafe Visitation with Logistic Regression for TimeJune
Series
18, 2024 3/7
Logistic Regression Model
Model Formula:
p
Logit(p) = log = β0 + β1 x1 + β2 x2
1−p
Where:
p is the probability of visiting the cafe.
β0 , β1 , β2 are model coefficients.
x1 is the visit on Day 7 (most recent day).
x2 is the number of visits in the past week.
Mansour Ahmady Phoulady Predicting Cafe Visitation with Logistic Regression for TimeJune
Series
18, 2024 4/7
Coefficient Assumptions
Assumed Coefficients:
β0 = −0.5 – Base effect of not visiting.
β1 = 1.0 – Influence of the most recent visit.
β2 = 0.5 – Influence of the total visits in the week.
Mansour Ahmady Phoulady Predicting Cafe Visitation with Logistic Regression for TimeJune
Series
18, 2024 5/7
Calculation
Feature Calculation:
x1 = 0 (did not visit on Day 7)
x2 = 4 (visited four times in the last week)
Log-Odds Calculation:
p
log = −0.5 + 1.0 × 0 + 0.5 × 4 = 1.5
1−p
Probability Calculation:
p
= e 1.5 ≈ 4.48
1−p
4.48
p= ≈ 0.82
1 + 4.48
Conclusion: There is approximately an 82% chance the customer will visit
the cafe on Day 8.
Mansour Ahmady Phoulady Predicting Cafe Visitation with Logistic Regression for TimeJune
Series
18, 2024 6/7
Conclusion
Mansour Ahmady Phoulady Predicting Cafe Visitation with Logistic Regression for TimeJune
Series
18, 2024 7/7