Unit 1 subjective questions Data preprocessing and visualization
BTY587 — Data Analysis And Simulations 20 questions with model answers. Write yours first, then compare.
-
Question 1 of 20
Define data and explain the different types of data encountered in data analysis. Illustrate each type with examples.
Model answer
Data refers to raw facts, figures, or observations collected from various sources that can be processed to extract meaningful information.
Types of Data:
-
Qualitative (Categorical) Data – Describes qualities or categories.
- Nominal Data: Categories with no natural order. Example: gender (Male, Female), colors (Red, Blue).
- Ordinal Data: Categories with a meaningful order but no fixed interval. Example: ratings (Poor, Average, Good), education level.
-
Quantitative (Numerical) Data – Represents measurable quantities.
- Discrete Data: Countable values. Example: number of students, cars in a lot.
- Continuous Data: Any value within a range. Example: height, weight, temperature.
Additional classification:
- Structured Data: Organized in rows and columns (e.g., databases).
- Unstructured Data: No predefined format (e.g., images, text, audio).
Understanding data types is crucial because it dictates the choice of statistical methods, visualizations, and preprocessing techniques.
-
-
Question 2 of 20
Explain the concept of data preprocessing. Why is it considered a critical step in the data analysis pipeline?
Model answer
Data preprocessing is the process of transforming raw data into a clean, usable, and meaningful format before analysis or modeling.
Key steps in preprocessing:
- Data Cleaning: Handling missing values, removing noise, and correcting inconsistencies.
- Data Integration: Combining data from multiple sources.
- Data Transformation: Normalization, scaling, and encoding.
- Data Reduction: Reducing dimensionality and volume while preserving information.
Why it is critical:
- Garbage In, Garbage Out (GIGO): Poor quality data leads to inaccurate models.
- Improves Accuracy: Clean data enhances model performance and reliability.
- Handles Real-World Imperfections: Real data is often incomplete, noisy, and inconsistent.
- Efficiency: Reduces computation time by eliminating redundant features.
Studies suggest data scientists spend nearly 60–80% of their time on data preprocessing, highlighting its importance.
-
Question 3 of 20
Discuss the various causes of missing data and classify the mechanisms of missingness (MCAR, MAR, MNAR).
Model answer
Missing data occurs when no value is stored for a variable in an observation.
Common causes:
- Errors during data entry.
- Equipment or sensor failures.
- Respondents skipping survey questions.
- Data corruption or loss during transfer.
- Merging incompatible datasets.
Mechanisms of Missingness:
-
MCAR (Missing Completely At Random): The probability of missing data is unrelated to any variable. Example: a sample tube accidentally breaks.
-
MAR (Missing At Random): Missingness depends on observed data but not on the missing value itself. Example: men are less likely to report weight, but missingness depends on gender (observed).
-
MNAR (Missing Not At Random): Missingness depends on the unobserved value itself. Example: high-income earners refusing to disclose income.
Identifying the mechanism helps in selecting the appropriate imputation strategy.
-
Question 4 of 20
Describe the various techniques for dealing with missing data. Compare deletion methods with imputation methods.
Model answer
Techniques for handling missing data:
1. Deletion Methods:
- Listwise Deletion: Remove entire rows with any missing value. Simple but causes data loss.
- Pairwise Deletion: Use available data for each analysis without discarding entire rows.
2. Imputation Methods:
- Mean/Median/Mode Imputation: Replace missing values with central tendency measures.
- Forward/Backward Fill: Used in time-series data.
- Regression Imputation: Predict missing values using regression models.
- KNN Imputation: Use nearest neighbors to estimate values.
- Multiple Imputation: Generate multiple plausible datasets and combine results.
Comparison:
Aspect Deletion Imputation Data Loss High Low Bias Can introduce bias Preserves data structure Complexity Simple Complex Best For Large data, few missing Small data, many missing Conclusion: Deletion is easy but wasteful; imputation preserves data but may introduce estimation error if done improperly.
-
Question 5 of 20
What is a scatter plot? Explain its purpose and how it is used to identify correlation between two variables.
Model answer
A scatter plot is a two-dimensional data visualization that uses Cartesian coordinates to display values of two numerical variables. Each point represents an observation with its and values.
Purpose:
- To examine the relationship between two continuous variables.
- To detect patterns, trends, clusters, and outliers.
Identifying Correlation:
- Positive Correlation: Points slope upward from left to right; as increases, increases.
- Negative Correlation: Points slope downward; as increases, decreases.
- No Correlation: Points are scattered randomly with no discernible pattern.
The strength can be quantified by the correlation coefficient , where :
Example: A scatter plot of hours studied vs exam score typically shows a positive correlation.
-
-
Question 6 of 20
Explain the construction and interpretation of a histogram. How does it differ from a bar chart?
Model answer
A histogram is a graphical representation of the frequency distribution of continuous numerical data, where data is grouped into bins (intervals).
Construction:
- Divide the data range into equal intervals (bins).
- Count the number of observations in each bin (frequency).
- Draw adjacent bars whose heights represent the frequency.
Interpretation:
- Reveals the shape of the distribution (normal, skewed, bimodal).
- Shows central tendency and spread.
- Helps detect outliers and gaps.
Histogram vs Bar Chart:
Feature Histogram Bar Chart Data Type Continuous Categorical Bars Adjacent (no gaps) Separated (gaps) X-axis Numerical intervals Categories Order Cannot be rearranged Can be rearranged Note: The number of bins greatly affects interpretation; too few oversimplifies, too many adds noise.
-
Question 7 of 20
Distinguish between a histogram and a scatter plot in terms of their use cases and the type of insights they provide.
Model answer
Both histograms and scatter plots are fundamental visualization tools but serve different purposes.
Histogram:
- Represents the distribution of a single variable.
- Uses bins to group continuous data.
- Answers: How is the data distributed? Is it skewed?
- Shows frequency, central tendency, and spread.
Scatter Plot:
- Represents the relationship between two variables.
- Uses individual points for each observation.
- Answers: Are the two variables related? Is there correlation?
- Shows trends, clusters, and outliers in bivariate data.
Comparison Table:
Aspect Histogram Scatter Plot Variables Univariate (1) Bivariate (2) Purpose Distribution Relationship Representation Bars/bins Points Detects Skewness, modality Correlation, clusters Summary: Use a histogram to understand one variable's spread and a scatter plot to explore relationships between two variables.
-
Question 8 of 20
Describe group plots (grouped/faceted plots). How do they help in comparing data across categories?
Model answer
Group plots (also called grouped plots or faceted plots) are visualizations that display data separated by one or more categorical variables, enabling side-by-side comparison.
Types of Group Plots:
- Grouped Bar Charts: Bars for different subgroups placed side by side.
- Faceting (Small Multiples): A grid of small charts, each for a subset of data.
- Grouped Box Plots: Multiple box plots for different categories.
- Grouped Scatter Plots: Points colored/shaped by category.
Benefits:
- Comparative Analysis: Easily compare distributions or trends across categories.
- Pattern Detection: Reveals differences between subgroups (e.g., sales by region).
- Reduces Clutter: Faceting separates overlapping data into distinct panels.
- Multivariate Insight: Incorporates categorical dimensions alongside numerical ones.
Example: Comparing exam scores across different classes using grouped box plots highlights which class performs better and its variability.
Best Practice: Keep consistent scales across facets for fair comparison.
-
Question 9 of 20
Explain the structure of a box plot (box-and-whisker plot). Describe each component and how outliers are identified.
Model answer
A box plot is a standardized visualization that displays the distribution of numerical data using five-number summary statistics.
Five-Number Summary:
- Minimum – smallest non-outlier value.
- First Quartile () – 25th percentile.
- Median () – 50th percentile.
- Third Quartile () – 75th percentile.
- Maximum – largest non-outlier value.
Components:
- Box: Spans from to , representing the Interquartile Range (IQR).
- Median Line: A line inside the box.
- Whiskers: Extend to the minimum and maximum within .
- Outliers: Points beyond the whiskers, plotted individually.
Outlier Detection:
- Lower Bound:
- Upper Bound:
Any value outside these bounds is considered an outlier.
Use: Box plots are excellent for comparing distributions and spotting skewness and outliers.
-
Question 10 of 20
For the dataset , compute the five-number summary and determine the IQR. Identify if any outliers exist.
Model answer
Given dataset (sorted): ()
Step 1: Median ()
With even , median is the average of the 3rd and 4th values:Step 2: First Quartile ()
Lower half: ; median = .Step 3: Third Quartile ()
Upper half: ; median = .Step 4: Five-Number Summary
- Minimum =
- Median =
- Maximum =
Step 5: IQR
Step 6: Outlier Bounds
- Lower:
- Upper:
Conclusion: All values lie within , so there are no outliers.
-
Question 11 of 20
What is dimensionality reduction? Explain the need for it and the problems associated with high-dimensional data (curse of dimensionality).
Model answer
Dimensionality reduction is the process of reducing the number of input variables (features) in a dataset while retaining as much meaningful information as possible.
Need for Dimensionality Reduction:
- Reduce Computation: Fewer features mean faster training.
- Avoid Overfitting: Fewer irrelevant features improve generalization.
- Visualization: Reduce to 2D/3D for plotting.
- Remove Redundancy: Eliminate correlated/noisy features.
Curse of Dimensionality:
As the number of dimensions increases:- Data becomes sparse; points appear equidistant.
- Distance metrics lose meaning, harming algorithms like KNN.
- Volume grows exponentially, requiring exponentially more data.
- Overfitting risk increases dramatically.
Two Approaches:
- Feature Selection: Choose a subset of original features.
- Feature Extraction: Transform features into a lower-dimensional space (e.g., PCA).
Conclusion: Dimensionality reduction improves efficiency, accuracy, and interpretability of models.
-
Question 12 of 20
Explain Principal Component Analysis (PCA) as a dimensionality reduction technique. Outline its main steps.
Model answer
Principal Component Analysis (PCA) is a linear feature extraction technique that transforms correlated variables into a set of uncorrelated variables called principal components, ordered by the variance they capture.
Key Idea: Project data onto directions (principal components) that maximize variance.
Main Steps:
-
Standardize the Data: Center and scale features to zero mean and unit variance.
-
Compute Covariance Matrix:
-
Eigen Decomposition: Calculate eigenvalues () and eigenvectors () of the covariance matrix:
-
Sort Eigenvectors: Rank by eigenvalues in descending order. Larger eigenvalues capture more variance.
-
Select Top Components: Choose the top eigenvectors to form the projection matrix.
-
Transform Data: Project original data onto the new subspace.
Advantages: Reduces dimensions, removes correlation, and aids visualization.
Limitation: It is linear and components may be hard to interpret. -
-
Question 13 of 20
Compare Feature Selection and Feature Extraction approaches to dimensionality reduction with examples.
Model answer
Both are approaches to dimensionality reduction but differ fundamentally in how they reduce features.
Feature Selection:
- Selects a subset of the original features.
- Original features are preserved (interpretable).
- Methods:
- Filter Methods: Correlation, Chi-square, Information Gain.
- Wrapper Methods: Recursive Feature Elimination (RFE).
- Embedded Methods: LASSO regularization.
Feature Extraction:
- Transforms features into a new, lower-dimensional space.
- Creates new features (combinations of originals) that may lose interpretability.
- Methods: PCA, LDA, t-SNE, Autoencoders.
Comparison Table:
Aspect Feature Selection Feature Extraction Output Subset of originals New transformed features Interpretability High Low Information Loss Discards features Combines features Example LASSO, RFE PCA, t-SNE Conclusion: Use feature selection when interpretability matters and feature extraction when maximizing information compression.
-
Question 14 of 20
Distinguish between nominal, ordinal, interval, and ratio scales of measurement with suitable examples.
Model answer
The four scales of measurement classify data based on their properties.
1. Nominal Scale:
- Categories with no order.
- Only equality/labels apply.
- Example: Gender, Eye color, Blood type.
2. Ordinal Scale:
- Ordered categories, but intervals are not equal.
- Example: Rankings (1st, 2nd), Satisfaction (Low, Medium, High).
3. Interval Scale:
- Ordered with equal intervals, but no true zero.
- Example: Temperature in Celsius, Calendar dates. ( does not mean 'no temperature').
4. Ratio Scale:
- Ordered, equal intervals, and a true zero.
- Ratios are meaningful.
- Example: Height, Weight, Age, Income.
Comparison Table:
Scale Order Equal Intervals True Zero Nominal No No No Ordinal Yes No No Interval Yes Yes No Ratio Yes Yes Yes Understanding scales guides the selection of appropriate statistical operations.
-
Question 15 of 20
Explain the impact of outliers on data analysis. Describe methods to detect and handle them.
Model answer
Outliers are data points that significantly deviate from other observations.
Impact on Analysis:
- Distort Statistics: Mean and standard deviation get heavily skewed.
- Mislead Models: Regression lines get pulled toward outliers.
- Reduce Accuracy: Machine learning models may learn noise.
- Affect Visualizations: Compress scales and hide patterns.
Detection Methods:
- Statistical (IQR Method): Values outside or .
- Z-Score Method: Values with where .
- Visualization: Box plots and scatter plots.
- Clustering: Points far from clusters (e.g., DBSCAN).
Handling Methods:
- Removal: Delete if they are errors.
- Transformation: Apply log/square-root to reduce skew.
- Capping (Winsorization): Replace extreme values with boundary values.
- Imputation: Treat as missing and impute.
Note: Not all outliers are errors; some represent important rare events (e.g., fraud).
-
Question 16 of 20
Describe data normalization and standardization. Why are these transformations important, and how do they differ?
Model answer
Normalization and standardization are feature scaling techniques used during data preprocessing to bring features onto a comparable scale.
Normalization (Min-Max Scaling):
- Rescales data to a fixed range, typically .
- Sensitive to outliers.
Standardization (Z-score Scaling):
- Transforms data to have mean and standard deviation .
- Less sensitive to outliers; does not bound values.
Why Important:
- Prevents features with large ranges from dominating.
- Improves convergence of gradient-based algorithms.
- Essential for distance-based algorithms (KNN, SVM, K-Means).
Differences:
Aspect Normalization Standardization Range Bounded [0,1] Unbounded Formula Min-Max Z-score Outlier Sensitivity High Lower Use Case Neural nets, image data Algorithms assuming Gaussian Conclusion: Choose based on the algorithm and the data distribution.
-
Question 17 of 20
Explain how a box plot can be used to compare skewness and spread across multiple groups. Provide an interpretation guide.
Model answer
Box plots are powerful for comparing the distribution of a numerical variable across multiple groups side by side.
Interpreting Skewness:
- Symmetric: Median is centered in the box; whiskers are equal length.
- Right (Positive) Skew: Median closer to ; longer upper whisker.
- Left (Negative) Skew: Median closer to ; longer lower whisker.
Interpreting Spread:
- Box Length (IQR): Larger box = greater variability in the middle 50%.
- Whisker Length: Indicates the range of non-outlier data.
- Outliers: Individual points reveal extreme values.
Comparing Groups:
- Median Position: Compare central tendencies across groups.
- Box Sizes: Compare variability; wider boxes = more spread.
- Overlap: Little overlap suggests groups differ significantly.
Example Interpretation Guide:
Observation Meaning Higher median Group has larger central value Wider box More variability Many outliers Presence of extremes Off-center median Skewed distribution Use Case: Comparing salaries across departments quickly reveals which department pays more and has higher inequality.
-
Question 18 of 20
Discuss the role of data visualization in Exploratory Data Analysis (EDA). List and briefly describe key plots used.
Model answer
Data visualization is central to Exploratory Data Analysis (EDA), the process of summarizing and understanding data before formal modeling.
Role of Visualization in EDA:
- Pattern Recognition: Reveals trends, cycles, and clusters.
- Anomaly Detection: Spots outliers and errors.
- Distribution Understanding: Shows shape, skew, and modality.
- Relationship Discovery: Uncovers correlations between variables.
- Communication: Presents findings intuitively to stakeholders.
Key Plots:
- Histogram: Shows distribution of a single continuous variable.
- Scatter Plot: Reveals relationships between two numerical variables.
- Box Plot: Summarizes spread, median, and outliers.
- Bar Chart: Compares categorical frequencies.
- Group/Faceted Plots: Compare distributions across categories.
- Heatmap: Visualizes correlation matrices.
- Line Plot: Displays trends over time.
Conclusion: Visualization transforms raw numbers into actionable insights and guides subsequent preprocessing and modeling decisions.
-
Question 19 of 20
Compare t-SNE and PCA as dimensionality reduction techniques, highlighting their strengths, weaknesses, and use cases.
Model answer
Both PCA and t-SNE reduce dimensionality but operate on fundamentally different principles.
PCA (Principal Component Analysis):
- Type: Linear technique.
- Objective: Maximize variance along orthogonal components.
- Strengths: Fast, deterministic, preserves global structure, good for preprocessing.
- Weaknesses: Cannot capture non-linear relationships.
t-SNE (t-Distributed Stochastic Neighbor Embedding):
- Type: Non-linear technique.
- Objective: Preserve local neighborhood structure by matching probability distributions.
- Strengths: Excellent for visualizing clusters in 2D/3D.
- Weaknesses: Computationally expensive, non-deterministic, poor at preserving global distances, sensitive to hyperparameters (perplexity).
Comparison Table:
Aspect PCA t-SNE Linearity Linear Non-linear Structure Global Local Speed Fast Slow Determinism Deterministic Random Best Use Preprocessing, compression Visualization Conclusion: Use PCA for feature reduction and speed; use t-SNE for visualizing complex, high-dimensional clusters.
-
Question 20 of 20
A dataset contains missing values in a numerical column. Explain, with reasoning, how you would decide between mean, median, and mode imputation, and mention the drawbacks of each.
Model answer
Choosing an imputation strategy depends on the data type, distribution, and presence of outliers.
1. Mean Imputation:
- Replaces missing values with the arithmetic mean.
- Use When: Data is numerical and symmetrically distributed without outliers.
- Drawbacks: Highly sensitive to outliers; reduces variance; distorts distribution.
2. Median Imputation:
- Replaces missing values with the median (middle value).
- Use When: Data is numerical and skewed or contains outliers.
- Drawbacks: Ignores relationships between variables; still reduces variability.
3. Mode Imputation:
- Replaces missing values with the most frequent value.
- Use When: Data is categorical or discrete.
- Drawbacks: Can over-represent the dominant category; unsuitable for continuous data.
Decision Logic:
- If categorical → use mode.
- If numerical & symmetric → use mean.
- If numerical & skewed / outliers present → use median.
General Drawback: All single-value imputation methods underestimate variance and ignore feature correlations. Advanced methods like KNN or Multiple Imputation address this better.
That's unit 1
Long answers stick best when they're tested again soon. Run the MCQs on this unit, then come back to the questions you found hardest.
Nearly through. Did unit 1 of BTY587 save you a night before the exam?
LPU Notes is free. A student pays for the servers.
Did unit 1 of BTY587 save you a night before the exam?
Then you can help keep it free for the next batch. Ads cover part of the server bill; the rest comes out of a student's own pocket: the domain, the storage, and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason. to try again.
Nothing here is ever locked, and nothing unlocks.