Notes: official code is at the bottom.
For hypothesis 2, focus on results with clustering and fixed
effects model
Code result:
C:\Users\sfdas>python [Link]
Files loaded successfully!
--- RESULTS FOR HYPOTHESIS 1 ---
OLS Regression Results
========================================================================
======
Dep. Variable: collected_funds R-squared: 0.109
Model: OLS Adj. R-squared: 0.109
Method: Least Squares F-statistic: 203.9
Date: Thu, 25 Dec 2025 Prob (F-statistic): 8.80e-125
Time: 18:17:14 Log-Likelihood: -47469.
No. Observations: 5000 AIC: 9.495e+04
Df Residuals: 4996 BIC: 9.497e+04
Df Model: 3
Covariance Type: nonrobust
========================================================================
============
coef std err t P>|t| [0.025 0.975]
------------------------------------------------------------------------------------
Intercept 900.7696 124.427 7.239 0.000 656.837 1144.702
campaign_quality 164.0430 18.208 9.009 0.000 128.347 199.739
goal 0.1945 0.009 21.117 0.000 0.176 0.213
business_venture -320.5232 99.834 -3.211 0.001 -516.241 -124.805
========================================================================
======
Omnibus: 5446.150 Durbin-Watson: 2.015
Prob(Omnibus): 0.000 Jarque-Bera (JB): 1131861.574
Skew: 5.138 Prob(JB): 0.00
Kurtosis: 75.989 Cond. No. 2.32e+04
========================================================================
======
Notes:
[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.
[2] The condition number is large, 2.32e+04. This might indicate that there are
strong multicollinearity or other numerical problems.
--- RESULTS FOR HYPOTHESIS 2 ---
OLS Regression Results
========================================================================
======
Dep. Variable: dailycontrib R-squared: 0.028
Model: OLS Adj. R-squared: 0.027
Method: Least Squares F-statistic: 113.4
Date: Thu, 25 Dec 2025 Prob (F-statistic): 2.75e-49
Time: 18:17:14 Log-Likelihood: -21077.
No. Observations: 8000 AIC: 4.216e+04
Df Residuals: 7997 BIC: 4.218e+04
Df Model: 2
Covariance Type: nonrobust
========================================================================
============
coef std err t P>|t| [0.025 0.975]
------------------------------------------------------------------------------------
Intercept 1.2738 0.078 16.346 0.000 1.121 1.427
daily_total_perk 0.0002 1.87e-05 9.380 0.000 0.000 0.000
day -0.0447 0.003 -13.405 0.000 -0.051 -0.038
========================================================================
======
Omnibus: 25270.399 Durbin-Watson: 1.082
Prob(Omnibus): 0.000 Jarque-Bera (JB): 3246414474.500
Skew: 50.190 Prob(JB): 0.00
Kurtosis: 3122.161 Cond. No. 5.16e+03
========================================================================
======
Notes:
[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.
[2] The condition number is large, 5.16e+03. This might indicate that there are
strong multicollinearity or other numerical problems.
Code:
import pandas as pd
import [Link] as smf
import [Link] as sm
import [Link] as plt
# 1. LOAD THE DATASETS
# Replace the names inside quotes with your actual file names
try:
df_campaign = pd.read_csv('BE603_campaigns_36.csv')
df_contrib = pd.read_csv('BE603_contrib_36.csv')
print("Files loaded successfully!")
except FileNotFoundError:
print("Error: The CSV files were not found. Check your file names and
folder path.")
# --- HYPOTHESIS 1 (Campaign Dataset) ---
# Testing if quality signals (images/videos) affect total funds.
# Equation: collected_funds = B0 + B1(campaign_quality) + B2(goal) +
B3(business_venture)
model1 = [Link](formula='collected_funds ~ campaign_quality + goal +
business_venture',
data=df_campaign).fit()
print("\n--- RESULTS FOR HYPOTHESIS 1 ---")
print([Link]())
# --- HYPOTHESIS 2 (Contribution Dataset) ---
# Testing for "Social Proof" (Momentum): Do existing funds attract more
daily donors?
# Equation: dailycontrib = B0 + B1(daily_total_perk) + B2(day)
model2 = [Link](formula='dailycontrib ~ daily_total_perk + day',
data=df_contrib).fit()
print("\n--- RESULTS FOR HYPOTHESIS 2 ---")
print([Link]())
# --- STEP 4: MODEL ADEQUACY (Residual Check) ---
# This creates a Q-Q plot to see if your errors are normally distributed
fig = [Link]([Link], line='s')
[Link]("Normal Q-Q Plot of Residuals (H1)")
[Link]()
Fixed effect model results: (no clustering)
--- FIXED EFFECTS RESULTS FOR HYPOTHESIS 2 ---
PanelOLS Estimation Summary
========================================================================
========
Dep. Variable: dailycontrib R-squared: 0.0081
Estimator: PanelOLS R-squared (Between): -1.3870
No. Observations: 8000 R-squared (Within): 0.0081
Date: Fri, Dec 26 2025 R-squared (Overall): -0.1249
Time: 14:46:15 Log-likelihood -2.088e+04
Cov. Estimator: Unadjusted
F-statistic: 63.594
Entities: 200 P-value 0.0000
Avg Obs: 40.000 Distribution: F(1,7799)
Min Obs: 40.000
Max Obs: 40.000 F-statistic (robust): 63.594
P-value 0.0000
Time periods: 40 Distribution: F(1,7799)
Avg Obs: 200.00
Min Obs: 200.00
Max Obs: 200.00
Parameter Estimates
========================================================================
============
Parameter Std. Err. T-stat P-value Lower CI Upper CI
------------------------------------------------------------------------------------
daily_total_perk -0.0003 3.982e-05 -7.9746 0.0000 -0.0004 -0.0002
========================================================================
============
F-test for Poolability: 2.9173
P-value: 0.0000
Distribution: F(199,7799)
Included effects: Entity
Hypothesis 2 code without clustered standard errors
# 1. LOAD THE DATASET
try:
df_contrib = pd.read_csv('BE603_contrib_36.csv')
print("File loaded successfully!")
except FileNotFoundError:
print("Error: Check your file path or name.")
# 2. PREPARE DATA FOR FIXED EFFECTS
# We use 'id' as the entity index and 'day' as the time index
df_fe = df_contrib.set_index(['id', 'day'])
# 3. RUN FIXED EFFECTS (FE) MODEL
# EntityEffects=True tells Python to compare each campaign only to itself
over time
model_fe = PanelOLS.from_formula(
'dailycontrib ~ daily_total_perk + EntityEffects',
data=df_fe
).fit()
print("\n--- FIXED EFFECTS RESULTS FOR HYPOTHESIS 2 ---")
print(model_fe.summary)
Fixed effect model results with clustering
--- FIXED EFFECTS RESULTS (CLUSTERED SE) ---
PanelOLS Estimation Summary
========================================================================
========
Dep. Variable: dailycontrib R-squared: 0.0081
Estimator: PanelOLS R-squared (Between): -1.3870
No. Observations: 8000 R-squared (Within): 0.0081
Date: Sat, Dec 27 2025 R-squared (Overall): -0.1249
Time: 12:33:08 Log-likelihood -2.088e+04
Cov. Estimator: Clustered
F-statistic: 63.594
Entities: 200 P-value 0.0000
Avg Obs: 40.000 Distribution: F(1,7799)
Min Obs: 40.000
Max Obs: 40.000 F-statistic (robust): 3.2595
P-value 0.0710
Time periods: 40 Distribution: F(1,7799)
Avg Obs: 200.00
Min Obs: 200.00
Max Obs: 200.00
Parameter Estimates
========================================================================
============
Parameter Std. Err. T-stat P-value Lower CI Upper CI
------------------------------------------------------------------------------------
daily_total_perk -0.0003 0.0002 -1.8054 0.0710 -0.0007 2.724e-05
========================================================================
============
F-test for Poolability: 2.9173
P-value: 0.0000
Distribution: F(199,7799)
Included effects: Entity
Official code:
import pandas as pd
import [Link] as smf
import [Link] as sm
import [Link] as plt
from [Link] import PanelOLS
# 1. LOAD THE DATASETS
try:
df_campaign = pd.read_csv('BE603_campaigns_36.csv')
df_contrib = pd.read_csv('BE603_contrib_36.csv')
print("Files loaded successfully!")
except FileNotFoundError:
print("Error: The CSV files were not found. Check your file names.")
# --- STEP 3: RUNNING THE REGRESSIONS ---
# --- HYPOTHESIS 1 (Cross-Sectional OLS) ---
# Testing if quality signals affect total funds using the Campaign
dataset.
model1 = [Link](formula='collected_funds ~ campaign_quality + goal +
business_venture',
data=df_campaign).fit()
print("\n" + "="*40)
print("--- RESULTS FOR HYPOTHESIS 1 (OLS) ---")
print("="*40)
print([Link]())
# --- HYPOTHESIS 2 (Fixed Effects Panel Model) ---
# Testing for Social Proof using the Contribution dataset.
# We prepare the data by setting the MultiIndex (Entity=id, Time=day)
df_fe = df_contrib.set_index(['id', 'day'])
# We use Clustered Standard Errors to address autocorrelation
model2_fe = PanelOLS.from_formula(
'dailycontrib ~ daily_total_perk + EntityEffects',
data=df_fe
).fit(cov_type='clustered', cluster_entity=True)
print("\n" + "="*40)
print("--- RESULTS FOR HYPOTHESIS 2 (FIXED EFFECTS + CLUSTERED SE) ---")
print("="*40)
print(model2_fe.summary)
# --- STEP 4: MODEL ADEQUACY (Residual Check) ---
# Creating a Q-Q plot for Hypothesis 1 to check for normality/outliers
fig = [Link]([Link], line='s')
[Link]("Normal Q-Q Plot of Residuals (Hypothesis 1)")
[Link]()
# Optional: Print Durbin-Watson for Hypothesis 1 to discuss
autocorrelation
from [Link] import durbin_watson
dw1 = durbin_watson([Link])
print(f"\nDurbin-Watson for H1: {dw1:.4f}")