Analyzed customer churn for a telecom company using R. The project cleans the raw data, explores churn drivers, engineers features and builds a logistic regression model to flag high-risk customers (~80% accuracy), then turns the findings into retention recommendations.
Customer acquisition is costly, so growth depends on retaining existing customers. Telecom companies lose a large share of short-tenure and month-to-month customers. This project answers:
- Which factors drive churn?
- Which customer segments are most at risk?
- Can we predict churn probability early enough to act?
Telco Customer Churn Dataset (Kaggle). The raw CSV is not committed; download telco_churn.csv from Kaggle and place it in the repo root to run the pipeline from scratch. The cleaned intermediates (cleaned_churn_data.csv, final_churn_data.csv) are included.
| Script | What it does |
|---|---|
01_data_cleaning.R |
Loads telco_churn.csv, coerces TotalCharges to numeric, drops incomplete rows, factors Churn and writes cleaned_churn_data.csv |
02_eda.R |
ggplot2 charts: churn distribution and churn rate by contract type |
03_feature_engineering.R |
Bins tenure into groups (0-1yr, 1-2yr, 2-4yr, 4-6yr) and writes final_churn_data.csv |
04_modeling.R |
Logistic regression (Churn ~ tenure + MonthlyCharges + Contract, caret), 0.5 threshold, prints accuracy |
churn_analysis.Rmd knits the full analysis into a single HTML report.
- Month-to-month contracts show the highest churn.
- Early-tenure customers are most at risk.
Logistic regression. Accuracy: ~80%.
- Incentivize long-term contracts.
- Improve first-year customer onboarding.
R, dplyr, ggplot2, caret.
MIT. See LICENSE.