{"id":23031627,"url":"https://github.com/MNitin-Reddy/A-B-Testing-and-Regression-Analysis-for-Ad-Performance-Optimization","last_synced_at":"2025-08-14T15:31:48.744Z","repository":{"id":267939198,"uuid":"902784080","full_name":"MNitin-Reddy/A-B-Testing","owner":"MNitin-Reddy","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-13T10:45:41.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-13T11:30:55.413Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MNitin-Reddy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-13T09:05:26.000Z","updated_at":"2024-12-13T10:45:45.000Z","dependencies_parsed_at":"2024-12-13T11:42:20.035Z","dependency_job_id":null,"html_url":"https://github.com/MNitin-Reddy/A-B-Testing","commit_stats":null,"previous_names":["mnitin-reddy/a-b-testing"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MNitin-Reddy%2FA-B-Testing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MNitin-Reddy%2FA-B-Testing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MNitin-Reddy%2FA-B-Testing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MNitin-Reddy%2FA-B-Testing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MNitin-Reddy","download_url":"https://codeload.github.com/MNitin-Reddy/A-B-Testing/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229841026,"owners_count":18132559,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-15T15:39:47.476Z","updated_at":"2025-08-14T15:31:48.738Z","avatar_url":"https://github.com/MNitin-Reddy.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# A/B Testing and Regression Analysis for Ad Performance Optimization 📊\r\n\r\n## Business Problem\r\nAs a marketing agency, our objective is to **maximize the return on investment (ROI)** for our clients' advertising campaigns. We conducted two ad campaigns:\r\n1. **Facebook Ads**  \r\n2. **AdWords Ads**\r\n\r\nWe aim to determine which platform performs better in terms of:\r\n- Clicks  \r\n- Conversions  \r\n- Cost-effectiveness  \r\n\r\nThe insights will help optimize resource allocation and enhance advertising strategies.\r\n\r\n---\r\n\r\n## Research Question\r\n**Which ad platform is more effective in terms of conversions, clicks, and overall cost-effectiveness?**\r\n\r\n---\r\n\r\n## Dataset Description\r\n\r\nThe dataset contains daily performance metrics for both Facebook and AdWords campaigns throughout **2019**. Key features include:\r\n\r\n- **Date**: Campaign date (2019-01-01 to 2019-12-31)  \r\n- **Ad Views**: Number of views on the ads  \r\n- **Ad Clicks**: Number of clicks received on the ads  \r\n- **Ad Conversions**: Number of conversions resulting from the ads  \r\n- **Cost per Ad**: Cost associated with running the ad campaigns  \r\n- **Click-Through Rate (CTR)**  \r\n- **Conversion Rate**  \r\n- **Cost per Click (CPC)**  \r\n\r\n---\r\n\r\n## Technologies Used\r\n\r\n- **Python Libraries**: pandas, numpy, matplotlib, seaborn, scipy, statsmodels, scikit-learn  \r\n- **Tools**: Jupyter Notebook  \r\n- **Statistical Techniques**: Correlation Analysis, Hypothesis Testing, Regression Modeling, Cointegration Test  \r\n\r\n---\r\n\r\n## Analysis and Insights \r\n\r\n### 1. Distribution of Clicks and Conversions\r\n\r\nThe distributions of **clicks** and **conversions** show a symmetrical shape, indicating even performance across campaigns.\r\n\r\n**Visualization:**\r\n![Facebook and AdWords Clicks/Conversions](https://github.com/MNitin-Reddy/A-B-Testing/blob/main/images/Conversions%20and%20clicks%20distribution.png)\r\n\r\n---\r\n\r\n### 2. Frequency of Conversions by Categories\r\n\r\nWe categorized conversions into:\r\n- Less than 6  \r\n- 6–10  \r\n- 10–15  \r\n- More than 15  \r\n\r\n**Observations:**\r\n- Facebook had more frequent high-conversion days.\r\n- AdWords lacked days with conversions above 10.  \r\n\r\n**Visualization:**\r\n![Conversion Categories](https://github.com/MNitin-Reddy/A-B-Testing/blob/main/images/Frequency%20of%20conversions.png)\r\n\r\n---\r\n\r\n### 3. Do Clicks Lead to More Conversions?\r\n\r\nWe analyzed the **correlation** between clicks and conversions for both platforms:\r\n\r\n- Facebook: **Strong Positive Correlation** (0.87)  \r\n- AdWords: **Moderate Positive Correlation** (0.45)  \r\n\r\nThis suggests Facebook is more effective in driving conversions.\r\n\r\n**Visualization:**\r\n![Scatterplot Correlation](https://github.com/MNitin-Reddy/A-B-Testing/blob/main/images/Correlation.png)\r\n\r\n---\r\n\r\n### 4. Monthly Conversions Over Time\r\n\r\nConversions were analyzed across months:\r\n\r\n- Mondays and Tuesdays had the highest conversions.  \r\n- Monthly trends showed **increased conversions** over time with minor dips in February, May, and November.\r\n\r\n**Visualization:**\r\n![Monthly Conversions](https://github.com/MNitin-Reddy/A-B-Testing/blob/main/images/Monthly%20Conversions.png)\r\n\r\n---\r\n\r\n### 5. Monthly Cost Per Conversion (CPC)\r\n\r\nWe analyzed the **Cost Per Conversion** to understand advertising cost-effectiveness:\r\n\r\n- **May and November** had the lowest CPC values.  \r\n- February had the **highest CPC**, indicating less cost-effectiveness.\r\n\r\n**Visualization:**\r\n![Cost Per Conversion](https://github.com/MNitin-Reddy/A-B-Testing/blob/main/images/CPC.png)\r\n\r\n---\r\n\r\n### 6. Hypothesis Testing\r\n\r\n- **Hypothesis**: Facebook has more conversions than AdWords.  \r\n- **Result**:  \r\n  - Mean Conversions:  \r\n    - Facebook: **11.74**  \r\n    - AdWords: **5.98**  \r\n  - **p-value**: Extremely small (9.35e-134) → Reject the null hypothesis.  \r\n\r\n**Conclusion**: Facebook ads generate **significantly more conversions** than AdWords.\r\n\r\n---\r\n\r\n### 7. Linear Regression: Predicting Conversions from Clicks\r\n\r\nWe built a Linear Regression model for Facebook ads:\r\n\r\n- **R² Score**: 76.35%  \r\n- **Insights**: Predicting Facebook conversions based on clicks helps set realistic goals.  \r\n\r\nExample predictions:  \r\n- **For 50 clicks → ~9 conversions**  \r\n- **For 80 clicks → ~14 conversions**\r\n\r\n**Visualization:**\r\n![Linear Regression](https://github.com/MNitin-Reddy/A-B-Testing/blob/main/images/Regression%20Analysis.png)\r\n\r\n---\r\n\r\n### 8. Cointegration Test: Cost and Conversions\r\n\r\nA **cointegration test** showed a long-term equilibrium relationship between ad cost and conversions, suggesting stable budget impacts over time.\r\n\r\n---\r\n\r\n## Recommendations\r\n\r\n1. Allocate **more resources to Facebook Ads** due to their higher conversions and stronger ROI.  \r\n2. Optimize AdWords campaigns to improve click-to-conversion performance.  \r\n3. Increase ad spend during months with **lower CPC** (e.g., May, November).  \r\n4. Monitor and analyze performance during **Mondays and Tuesdays** for targeted campaigns.  \r\n\r\n---\r\n\r\n## Conclusion \r\n\r\nThe analysis demonstrates that **Facebook Ads outperform AdWords** in driving conversions. Businesses can leverage these findings to improve ad performance and ROI.\r\n\r\n---\r\n\r\n## How to Run 📥\r\n\r\n1. Clone the repository:  \r\n   ```bash\r\n   git clone https://github.com/yourusername/ad-campaign-analysis.git\r\n   cd ad-campaign-analysis\r\n   ```\r\n2. Install dependencies:  \r\n   ```bash\r\n   pip install -r requirements.txt\r\n   ```\r\n3. Run the notebook:  \r\n   ```bash\r\n   jupyter notebook notebooks/ad_campaign_analysis.ipynb\r\n   ```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMNitin-Reddy%2FA-B-Testing-and-Regression-Analysis-for-Ad-Performance-Optimization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMNitin-Reddy%2FA-B-Testing-and-Regression-Analysis-for-Ad-Performance-Optimization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMNitin-Reddy%2FA-B-Testing-and-Regression-Analysis-for-Ad-Performance-Optimization/lists"}