Data Science Starter · free course

Free course · Lesson 3 of 5

Statistical Inference & Data Mining

In this lesson you will

  • Choose between mean and median
  • Explain uncertainty in sample estimates

Statistical inference means drawing conclusions about a large population from a smaller sample. Data mining is the process of discovering hidden relationships and patterns in large datasets — like finding which factors most strongly predict patient outcomes or identifying clusters of similar schools for resource allocation.

  • Correlation analysis (df.corr()) measures how strongly two numeric variables move together. A value near +1 means they rise together; near -1 means one rises as the other falls; near 0 means no linear relationship.
  • A high correlation does not imply causation — always consider confounding factors.
  • Data mining often uses clustering (unsupervised learning) to group similar records — for example, grouping NGO programs by budget size, reach, and impact score.
  • In Jupyter Notebooks, use heatmaps (Seaborn) to visualize correlation matrices at a glance.

Practical Skill: Before building complex models, compute a correlation matrix to identify which features are redundant (highly correlated) and which are independent predictors. This saves time and improves model performance.

Worked exampleCorrelation Matrix & Trend Filtering

Python (Pandas & NumPy)

Python
# Finding correlations and significant trends in corporate data          # Install: pip install pandas numpy           import pandas as pd          import numpy as np           # Simulated corporate data: department performance          np.random.seed(42)          data = {              "training_hours": np.random.randint(10, 80, 8),              "productivity_score": np.random.uniform(50, 100, 8),              "employee_satisfaction": np.random.uniform(2, 5, 8),              "days_absent": np.random.randint(0, 15, 8)          }          df = pd.DataFrame(data)           print("=== Dataset ===")          print(df.round(1), "\n")           # Compute correlation matrix          corr = df.corr()          print("=== Correlation Matrix ===")          print(corr.round(3), "\n")           # Find the strongest correlation (excluding self)          corr_values = corr.unstack().drop_duplicates()          strongest = corr_values[corr_values.abs().argsort()[::-1]][:3]          print("=== Top 3 Strongest Correlations ===")          for pair, val in strongest.items():              if val != 1.0:                  print(f"  {pair[0]} vs {pair[1]}: {val:.3f}")           # Insight          print("\nInsight: High training hours may correlate with productivity.")          print("But check if satisfied employees are also more productive!")

Practice exercise

For incomes of 40, 55, 60, 65 and 500 (thousand SSP), calculate the mean and median and say which better describes a typical household.

Key takeaways

  • The median resists extreme values
  • Samples give estimates, not exact truths
  • Small groups give less precise estimates
In the full program Module 3: Statistics for Decisions See how this topic is taught in depth, with practical activities and an assessment.

Free self-study lesson — no certificate. For the full instructor-led program, see registration options.