Back to Data Science Notes
Topic #31

Types of Analytics

By the end of this lesson, you will be able to distinguish between descriptive, diagnostic, predictive, and prescriptive analytics and apply them to solve business problems.

What it is

Analytics is not a single monolithic activity but a hierarchy of questions we ask data. The four main types represent increasing complexity and value:

  • Descriptive Analytics: What happened? (Summarizing past data)
  • Diagnostic Analytics: Why did it happen? (Drilling down into causes)
  • Predictive Analytics: What will happen? (Forecasting future outcomes)
  • Prescriptive Analytics: How can we make it happen? (Recommending actions)

Think of these as a ladder: you cannot effectively predict or prescribe without first understanding what has already occurred and why.

Why it matters

  • Strategic Alignment: Helps teams choose the right tool for the question at hand rather than over-engineering simple summaries.
  • Actionable Insights: Moves organizations from passive reporting to active decision-making.
  • Resource Optimization: Prescriptive analytics directly impacts efficiency by suggesting optimal paths.
  • Risk Mitigation: Predictive models allow businesses to anticipate churn or fraud before losses occur.

Syntax or steps

While "syntax" usually refers to code, in analytics it refers to the logical workflow. A standard progression involves:

  1. Data Collection: Gather historical records.
  2. Aggregation: Calculate metrics like mean, sum, or count (Descriptive).
  3. Segmentation/Correlation: Break down metrics by category to find anomalies (Diagnostic).
  4. Modeling: Apply statistical algorithms to learn patterns (Predictive).
  5. Optimization: Use simulation or rules to recommend best actions (Prescriptive).

Example

The following Python example demonstrates how a single dataset can yield all four types of insights using basic libraries.

import pandas as pd
from sklearn.linear_model import LinearRegression
import numpy as np

# 1. Descriptive: What happened?
data = {'month': [1, 2, 3, 4], 'sales': [100, 150, 120, 200]}
df = pd.DataFrame(data)
avg_sales = df['sales'].mean()
print(f"Average Sales: {avg_sales}")

# 2. Diagnostic: Why did it happen?
# Assume we have marketing spend data
df['marketing_spend'] = [10, 20, 15, 30]
correlation = df['sales'].corr(df['marketing_spend'])
print(f"Sales vs Marketing Correlation: {correlation:.2f}")

# 3. Predictive: What will happen next month?
model = LinearRegression()
X = df[['marketing_spend']]
y = df['sales']
model.fit(X, y)
next_month_spend = [[35]]
predicted_sales = model.predict(next_month_spend)[0]
print(f"Predicted Next Month Sales: {predicted_sales:.2f}")

# 4. Prescriptive: How can we hit a target?
target_sales = 250
# Inverse prediction logic (simplified): 
# sales = intercept + slope * spend => spend = (sales - intercept) / slope
slope = model.coef_[0][0]
intercept = model.intercept_
required_spend = (target_sales - intercept) / slope
print(f"Required Spend to Hit Target: ${required_spend:.2f}")

Explanation: We start by calculating the average (Descriptive). Then we check if marketing spend correlates with sales (Diagnostic). Next, we train a linear regression model to forecast sales based on spend (Predictive). Finally, we reverse the equation to determine exactly how much spend is needed to reach a specific revenue goal (Prescriptive).

Common mistakes

  • Skipping Steps: Attempting predictive modeling without cleaning data or understanding baseline trends leads to garbage-in-garbage-out results.
  • Confusing Correlation with Causation: In diagnostic analytics, just because two variables move together doesn't mean one caused the other.
  • Over-reliance on Prediction: Treating predictive outputs as certainties rather than probabilities can lead to poor risk management.
  • Ignoring Actionability: Producing complex dashboards that describe history but offer no clear path for improvement (lack of prescription).

When to use it

TypeQuestion AnsweredBest For
DescriptiveWhat happened?Dashboards, KPI tracking, monthly reports.
DiagnosticWhy did it happen?Troubleshooting drops in performance, root cause analysis.
PredictiveWhat will happen?Inventory planning, demand forecasting, churn risk.
PrescriptiveWhat should we do?Dynamic pricing, route optimization, personalized recommendations.

Practice

Guided Exercise: Take a small CSV file of daily website traffic. Calculate the average visits per day (Descriptive). Identify which day of the week has the lowest traffic (Diagnostic).

Challenge: Using the same data, build a simple moving average to predict tomorrow's traffic (Predictive). Hint: Use pandas.rolling().

Quick check

Q: If a manager asks, "How can we reduce customer wait times?" which type of analytics is primarily required to answer this?

A: Prescriptive analytics, as it requires recommending specific operational changes to achieve a desired outcome.

Summary

Analytics types form a continuum from looking backward to acting forward. Mastery lies in selecting the appropriate level of analysis for the business question, ensuring that insights are not just observed but understood, anticipated, and acted upon.

Want to go beyond the notes?

Join Coding Now Tech Institute's Data Science course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Types of Analytics – FAQs

Quick answers about learning Types of Analytics in Data Science.

This free note from Coding Now Tech Institute explains Types of Analytics in Data Science — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every Data Science topic on Coding Now Tech Institute, including Types of Analytics, is 100% free with no signup required.
With focused practice, most students grasp Types of Analytics in 1–3 days from these notes; pairing it with Coding Now Tech Institute's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the Coding Now Tech Institute Community (/community) — expert instructors answer within 24 hours.
Call NowEnroll Now