Exploratory Analysis and Data Wrangling
Initial Data Preparation for Biomedical Machine Learning
1. Defining the Problem Before Analyzing Data
A machine learning analysis should begin with a clear definition of the target problem. A well-defined problem establishes what the analysis is intended to accomplish and provides criteria for determining whether the available data are appropriate.
A clearly stated problem is already partly solved because it establishes the direction, scope, and requirements of the analysis.
A problem definition should communicate:
The research problem: What question or practical issue is being addressed?
The goal or hypothesis: What outcome is the analysis intended to predict, explain, classify, or estimate?
The nature of the data: What types of observations, variables, and data sources are available?
The target outcome: What specific variable or event is of interest?
The size of the data: How many instances, subjects, or observations are available?
The quality of the data: How complete, accurate, consistent, and representative are the observations?
Available domain knowledge: What is already known about the biological, clinical, or social context?
Domain knowledge is especially important because it can reveal:
Potential sources of bias in how the data were collected.
Reasonable assumptions that can be made about the data.
Known predictors of the outcome.
Important covariates, which are variables associated with the outcome or with other predictors.
Features that will need to be extracted or engineered before modeling.
Relationships that may be statistically detectable but scientifically implausible.
A well-defined problem helps a researcher prepare a machine learning analysis independently and improves communication when working with data scientists or collaborators.
2. Data Collection Considerations
After defining the problem, the next stage is determining whether suitable data exist and how they can be obtained.
Important questions include:
Does the available data address the target problem?
Data should contain information relevant to the research question.
The target outcome must be measured appropriately.
What data sources already exist?
Sources may include electronic health records, clinical trials, registries, surveys, imaging databases, laboratory testing, genomic studies, or public repositories.
Are there privacy concerns?
Biomedical data may contain patient identifiers or sensitive health information.
Access, analysis, and sharing may require privacy protections.
Are there ethical requirements?
Certain projects may require ethical review, informed consent, or institutional approval.
Is the data publicly accessible?
Some data may require special permission, training, certifications, or formal approvals.
Where will the data be stored?
Adequate storage capacity is necessary.
Sensitive data require secure infrastructure and restricted access.
What is the data structure?
Data may be:
Structured: Organized in a predefined tabular format.
Semi-structured: Organized with some structure but not a rigid table, such as certain records or tagged files.
Unstructured: Raw images, audio, video, free text, or other material without a consistent tabular organization.
What processing is required before analysis?
Data may need conversion, cleaning, integration, or feature extraction.
Must new data be collected?
If existing data are insufficient, a new study may need to be designed.
Study design should specify what will be collected, from whom, under what conditions, and with what measurements.
These decisions affect not only the technical analysis but also the validity, ethics, security, and reproducibility of the research.
3. The “Bad Data” Machine Learning Pitfall
Poor-quality data can produce poor models, misleading conclusions, and incorrect scientific interpretations. This is often summarized as:
Bad data can lead to bad everything downstream.
3.1 Noisy Data
Noisy data contain information that is uninformative, conflicting, or misleading with respect to the target problem.
Examples include:
Features unrelated to the outcome.
Measurements with substantial random error.
Conflicting values from different sources.
Variables that obscure rather than clarify the underlying relationship.
Noise can make it harder for a model to identify genuine patterns.
3.2 Dirty Data
Dirty data contain errors or missing values that do not accurately represent the true values at the time of collection.
Examples include:
Typographical or data-entry errors.
Invalid measurements.
Inconsistent coding.
Missing observations.
Values recorded in the wrong units.
3.3 Sparse Data
Sparse data may have too few observations or too little information for reliable modeling.
Sparsity can involve:
A small sample size.
A large number of missing values.
Categorical variables with many possible categories.
High-cardinality variables, such as ZIP codes, where many values may occur only once or a few times.
Sparse data can make patterns difficult to estimate and can increase the risk of overfitting.
3.4 Biased Data
Biased data do not represent the target population or data-generating process fairly.
Potential causes include:
Selection bias: The way participants or observations were selected systematically favors some groups or outcomes.
Outliers: Extreme observations may distort summaries and model estimates.
Survivorship bias: Data are collected only from individuals who remain available for observation, such as patients who are still alive, excluding those who were lost or died.
Bias can cause a model to perform well on the collected data while failing to generalize to the intended population.
3.5 Duplicate Data and Redundant Features
Data may contain:
Duplicate instances: The same observation is included more than once.
Duplicate feature columns: A variable is accidentally recorded multiple times.
Perfectly correlated features: Two features contain the same information.
Highly correlated features: Several features provide nearly overlapping information.
Redundancy can inflate the apparent amount of information and may complicate interpretation or modeling.
3.6 Approaches for Addressing Bad Data
Three broad strategies help identify and address poor-quality data:
Clearly define and understand the target problem.
This provides the context needed to decide which variables are relevant or misleading.
Conduct exploratory data analysis.
EDA helps reveal errors, missingness, unusual distributions, class imbalance, and possible bias.
Follow best practices for data collection and cleaning.
Careful study design and systematic quality control reduce errors before modeling begins.
4. Determining the Required Sample Size
There is no universal sample-size rule for machine learning. The number of observations required depends on several factors:
Problem complexity: More difficult prediction problems require more data.
Algorithm complexity: Complex models generally need more observations than simple models.
Training and evaluation split: Holding out data for testing reduces the number of instances available for training.
Replication or validation requirements: Additional data may be needed for independent validation or replication.
Number of classes: Classification problems with several classes require sufficient observations in each class.
Number of features and parameters: More predictors or model parameters generally increase data requirements.
Noise level: Noisy data require more observations to distinguish genuine patterns from random variation.
Complexity of interactions: Detecting multivariate interactions requires more data than estimating simple relationships.
4.1 Rough Practical Guidelines
The following are broad, experience-based guidelines rather than strict statistical rules:
Simpler machine learning models: At least roughly 100 samples per class.
More complex models, such as deep learning: At least roughly 1,000 samples per class.
A more comfortable range for average problems: Around 5,000 samples per class.
A relatively strong position for many situations: Around 10,000 samples per class.
These values depend heavily on the problem. Clean and simple problems may require fewer observations, whereas complex, noisy, or highly imbalanced problems may require substantially more.
4.2 Why More Data Is Not Always Better
Increasing sample size does not automatically improve performance. Additional data may be harmful when they are:
Poor quality.
Inconsistent with the original data.
Collected under different conditions.
Biased toward a different population.
Incorrectly labeled.
More observations are useful only when they add reliable and relevant information.
4.3 Methods for Estimating Sample-Size Requirements
Researchers can use several approaches to estimate how much data may be needed:
Review similar published studies.
Previous work may provide practical evidence about sample sizes that produced effective models.
Use a class-based heuristic.
The target sample size may be defined as a chosen number of independent instances per class.
Use a feature-based heuristic.
The number of independent observations may be set as a chosen proportion greater than the number of features.
Use a parameter-based heuristic.
For linear or logistic regression, the number of observations may be related to the number of model parameters.
Simulate data.
Simulated datasets can show how model performance changes as sample size increases.
Evaluate model stability.
Repeated analyses with different sample sizes can indicate whether estimates and performance are becoming reliable.
Nonlinear algorithms and models intended to detect complex interactions generally require more observations than simple linear models.
In practice, researchers should collect as much high-quality data as they can reasonably afford, subject to time, financial, ethical, and logistical constraints.
5. Purposes of Data Preparation
Data preparation transforms collected data into a form that can support valid and effective machine learning.
Its main purposes are to:
Orient the analyst to the available data.
Understand its structure, variables, values, distributions, and limitations.
Convert the data into a usable format.
Ensure that algorithms and software packages can read and process the data.
Identify and remove errors and potential biases.
Detect missing values, impossible measurements, duplicates, leakage, and other problems.
Provide a small set of relevant and informative features.
Retain variables that contain useful information while reducing unnecessary complexity.
Data preparation is not a single isolated step. Exploratory analysis, wrangling, cleaning, and later processing often inform one another repeatedly.
Exploratory Data Analysis
6. Definition and Purpose of Exploratory Data Analysis
Exploratory data analysis, or EDA, is the investigation of data through summaries of its main characteristics and through visualizations. It is also called descriptive analysis.
EDA is used to:
Understand the overall structure of the dataset.
Discover patterns between features and the outcome.
Discover relationships among features.
Identify anomalies, outliers, and errors.
Examine distributions and variability.
Check assumptions required by downstream statistical tests.
Evaluate initial hypotheses.
Detect possible class imbalance.
Assess missingness.
Guide decisions about cleaning and feature processing.
EDA should not be viewed as a single step performed only at the beginning. Different aspects are useful at different stages:
Early EDA can assess data quality and reveal major problems.
Later EDA can verify that cleaning and processing were successful.
Pre-modeling EDA can help determine whether the data are ready for analysis.
EDA is best integrated continuously throughout the data-preparation phase.
6.1 Common Components of EDA
Feature Summary Statistics
Common summaries include:
Mean: The arithmetic average.
Median: The middle value after sorting observations.
Mode: The most frequently occurring value.
Range: The difference between the largest and smallest values.
Variance: A measure of how widely values vary around the mean.
Interquartile range: The spread between the first and third quartiles.
These statistics help describe central tendency, dispersion, skewness, and unusual values.
Determining Variable Types and Counts
EDA should establish:
Which variables are categorical.
Which variables are numeric.
Which variables are binary, ordinal, continuous, or discrete.
How many features and instances are present.
How many categories each categorical feature contains.
How many observations belong to each outcome class.
Variable type affects which summaries, visualizations, statistical tests, and machine learning methods are appropriate.
Examining Feature Correlations
Correlation analysis evaluates relationships among features. A correlation heat map can display the strength and direction of pairwise relationships.
This can reveal:
Redundant features.
Highly correlated groups of variables.
Potential multicollinearity.
Unexpected relationships.
Candidate variables for removal or further investigation.
Correlation does not establish causation, and a lack of correlation does not necessarily imply a lack of predictive value, particularly for nonlinear relationships.
Examining Feature–Outcome Associations
EDA can examine the relationship between each individual feature and the outcome, known as a univariate association.
Possible methods include:
Statistical tests of association.
Bar plots for categorical variables.
Scatter plots for numeric variables.
Grouped summaries.
Distribution plots comparing outcome groups.
These analyses can help identify potentially predictive variables and test preliminary hypotheses.
Class Distribution
For classification tasks, EDA should determine whether outcome classes are balanced.
A dataset is class imbalanced when one class represents a much larger proportion of observations than another. The degree of imbalance can affect:
Model training.
Predicted class frequencies.
Performance measures.
Interpretation of accuracy and other evaluation results.
Missingness
EDA should count missing values:
Across features.
Across individual instances.
Within outcome classes or other important subgroups.
The pattern and extent of missingness influence whether variables or instances should be retained, removed, or imputed.
Outlier Detection
EDA should identify observations that differ substantially from the rest of the dataset. Candidate methods include:
Sorting values.
Data visualization.
Statistical tests such as the z-score.
Interquartile-range-based rules.
Outlier detection should be combined with domain knowledge because unusual values may be either valid observations or errors.
Class Imbalance
7. The Class-Imbalance Pitfall
Class imbalance occurs when a dataset contains a much larger proportion of one outcome class than another.
For example, a disease dataset may contain many more controls than affected patients. A model trained on such data may appear accurate simply by favoring the majority class.
Class imbalance can:
Influence some learning algorithms.
Cause the model to underrepresent the minority class.
Distort evaluation results.
Make accuracy misleading.
Affect conclusions about model usefulness.
7.1 Strategies for Handling Class Imbalance
Retain the Original Imbalance
The original class proportions can be preserved while explicitly accounting for the imbalance.
This strategy requires:
Recognizing that the classes are imbalanced.
Selecting suitable evaluation metrics.
Interpreting results in light of the class distribution.
Paying particular attention to performance on the minority class.
Preserving the original distribution is often preferable because it maintains the population structure and avoids manufacturing or discarding observations.
Undersampling
Undersampling randomly removes observations from the majority class until the classes are more balanced.
Advantages:
Produces a more balanced training set.
Can reduce computational demands.
Disadvantages:
Discards potentially useful observations.
Reduces total sample size.
May reduce statistical power.
Can remove important variation from the majority class.
Because loss of sample size is generally undesirable, undersampling should be used cautiously.
Oversampling
Oversampling repeatedly samples observations from the minority class to increase its apparent size.
Advantages:
Retains the majority-class observations.
Produces a more balanced class distribution.
Disadvantages:
Repeated observations do not provide genuinely new information.
It can introduce bias.
It may cause the model to overemphasize the minority observations.
It effectively manufactures a more balanced dataset without collecting new independent data.
Oversampling should be avoided unless it is clearly justified and carefully implemented.
Data Wrangling
8. Definition and Scope
Data wrangling, also called data munging, is the process of cleaning and unifying messy, complex data so that it can be accessed and analyzed effectively.
For machine learning analysis, data wrangling commonly includes:
Feature extraction
Data formatting
Data cleaning
Data integration
Data wrangling is closely connected to EDA because examining the data often reveals the transformations and corrections that are needed.
Data wrangling can also support the preparation of data as a resource for other analysts. That broader activity may include:
Structuring data.
Enriching data.
Validating data.
Publishing data.
The focus here is on transformations needed for analysis and modeling.
9. Feature Extraction
9.1 Definition
Feature extraction is the process of creating informative features from raw data when the original data cannot be used directly for analysis.
Raw data may be non-tabular, highly complex, or difficult for conventional algorithms to process. Feature extraction transforms it into variables that represent meaningful characteristics of the original data.
Extracted features should accurately represent the relevant information in the raw data.
9.2 Manual Feature Extraction
A researcher can manually design features based on domain knowledge.
For an image of a car, possible manually constructed features might include:
Number of wheels.
Color.
Shape or size.
Presence of specific components.
The extracted characteristics can then be placed into a standard tabular dataset for machine learning.
9.3 Automated Feature Extraction
Feature extraction can also be automated through machine learning.
For example:
Deep learning can automatically learn useful representations from images, audio, video, or text.
Some models can extract features and perform prediction directly from non-tabular data.
Unsupervised learning methods can identify compressed or informative representations without outcome labels.
9.4 Examples of Raw Data Requiring Feature Extraction
Feature extraction may be needed for:
Images.
Audio.
Video.
Unstructured text.
Time-series data.
9.5 Example: Detecting Spam Emails
Suppose unstructured email text is used to predict whether a message is spam.
Manually engineered features could indicate:
Whether the word “money” appears.
Whether the word “pills” appears.
Whether the email contains spelling errors.
Whether the sender is known.
Other characteristics of the message content or sender.
These engineered variables convert unstructured emails into a tabular dataset that can be used by a conventional machine learning model.
9.6 Feature-Extraction Techniques
Feature-extraction methods depend on the problem and data type.
Bag of Words
The bag-of-words technique represents text by counting how often words occur.
Advantages:
Simple to implement.
Converts text into numerical features.
Can identify frequently occurring terms.
Limitation:
It ignores grammar and word order.
Words with different meanings based on context may be treated similarly.
Disregarding order can remove information that is important for prediction.
Autoencoders
An autoencoder is a neural network that learns a compressed representation of raw data.
It can be used to:
Compress images or other complex inputs.
Capture important structure in high-dimensional data.
Produce a lower-dimensional representation for later analysis.
Unsupervised Learning
Various unsupervised learning methods can be used to discover useful representations without relying on labeled outcomes. These representations may then be supplied to downstream predictive models.
9.7 Feature Extraction and Feature Learning
Feature extraction and feature learning are related but distinct terms.
Feature extraction generally emphasizes creating or transforming raw variables into usable features.
Feature learning emphasizes allowing an algorithm to learn useful representations from data.
The distinction becomes particularly important when discussing neural networks and other feature-processing methods.
10. Data Formatting
10.1 Definition
Data formatting is the organization of information according to predefined specifications. It ensures compatibility with algorithms, software packages, and analysis workflows.
10.2 File Type and Extension
Data may need to be stored in an appropriate format, such as:
Tab-delimited text files, often using a
.txtextension.Comma-separated value files, often using a
.csvextension.
The chosen format must be supported by the downstream software and should preserve the information accurately.
10.3 Orientation of Features and Instances
Tabular data may be organized in different orientations:
Features as rows and instances as columns.
Features as columns and instances as rows.
Many machine learning tools expect:
Rows: Instances or observations.
Columns: Features or variables.
If the dataset is reversed, it may need to be transposed before analysis.
10.4 Headers and Labels
Formatting decisions include whether the file contains a header and which labels are used.
Headers may identify:
Feature names.
The outcome variable.
Instance identifiers.
The expected naming conventions and permitted labels may depend on the software package.
10.5 Column Order
Some algorithms or packages require columns to occur in a specific order.
For example:
The outcome may need to appear in the first column.
Features may need to follow the outcome.
An instance ID may need to occupy a particular position.
Formatting requirements should be checked before analysis to avoid incorrect interpretation of columns.
10.6 Numerical Encoding
Some data must be converted into numerical form.
Examples include:
Converting start and stop dates into a single time-duration feature.
Converting text values into numerical codes.
Transforming categorical or textual information into a representation accepted by a learning algorithm.
Many machine learning libraries require input values to be numerically encoded.
However, numerical encoding of categorical variables requires caution. If categories are assigned values such as 1, 2, and 3, many algorithms may interpret those numbers as quantitative values with meaningful order and spacing. This can create an artificial relationship that does not exist.
10.7 Missing-Value Identifiers
Missing values should use a consistent, recognized representation.
Numerical placeholders such as -9 or -999 are generally discouraged because a software package may mistake them for valid numerical quantities. A standard missing-value marker reduces the risk of downstream errors.
Data Cleaning
11. Definition and Goals
Data cleaning is the removal or correction of corrupted, inaccurate, biased, or useless records and variables.
Cleaning should preserve valid information while reducing errors and unnecessary complexity. Domain knowledge is essential because a value that appears unusual statistically may still be scientifically valid.
12. Removing Redundant Features and Instances
12.1 Redundant Features
Redundant features may include:
Duplicate columns accidentally included more than once.
Perfectly correlated features.
Features that contain nearly the same information.
When two features are perfectly correlated, all but one can often be removed without losing information. Reducing the number of features can:
Simplify the dataset.
Reduce computational demands.
Improve interpretability.
Limit problems caused by redundant information.
The correlations should be documented. If the retained feature later appears important, the other correlated variables may be relevant candidates for investigating causality or alternative explanations.
12.2 Redundant Instances
Duplicate instances may result from accidental repeated entry or merging errors.
However, identical feature values and outcomes do not necessarily prove that two observations are duplicates. Two individuals may genuinely have the same recorded characteristics and outcome while still representing independent samples.
Consequently, duplicate removal should use identifiers, collection records, and domain knowledge rather than feature similarity alone.
13. Irrelevant Features and Data Leakage
13.1 Irrelevant Features
An irrelevant feature provides no meaningful value for predicting or explaining the outcome. Such features may be removed to:
Reduce noise.
Simplify the model.
Improve computational efficiency.
Avoid distracting the learning algorithm.
13.2 Definition of Data Leakage
Data leakage occurs when information that should not be available during model training is used to train the model.
Leakage often produces unrealistically strong performance because the model gains access to information that would not be available when making real-world predictions.
13.3 Common Forms of Leakage
Leakage can occur when:
A feature contains information from the future relative to the prediction time.
A variable is measured only after the outcome has occurred.
The outcome label is accidentally included among the features.
Data-processing decisions use information from held-out evaluation data.
A variable indirectly encodes the outcome.
13.4 Biomedical Example
Suppose the goal is to predict whether a patient in an emergency room will be admitted to the intensive care unit.
A feature recording the total time until ICU admission would create leakage. Although this value may appear in the completed dataset, it would not be available at the time the prediction must be made. The model would therefore be relying on information from the future.
13.5 Preventing Data Leakage
Prevention requires:
Understanding what every feature represents.
Considering when each variable becomes available in practice.
Relating each feature to the exact prediction target and prediction time.
Removing variables that encode future or outcome information.
Separating the outcome from the predictors.
Investigating any model performance that appears unexpectedly high.
A model that achieves perfect or nearly perfect performance should be examined skeptically. An important diagnostic question is whether a mistake, leakage source, or data-processing error is responsible.
Outliers
14. Definition and Interpretation
An outlier is an observation that lies an unusually large distance from the other observations in a sample.
Outliers may represent:
Real but extreme cases.
Important edge cases.
Errors in data collection.
Impossible measurements.
Values recorded in the wrong units.
Data-entry mistakes.
Statistical unusualness alone does not establish that an observation is erroneous.
14.1 Impossible Outliers
Impossible outliers should generally be corrected or removed because they often indicate data-collection errors.
Examples include:
A human patient recorded as being 180 years old.
A patient aged 18 in a study specifically focused on Alzheimer’s disease, when the study’s eligibility criteria make that age implausible.
Possible actions include:
Converting the value to missing.
Correcting it if the true value can be verified.
Removing the entire instance if the observation cannot be recovered and is invalid.
These decisions should be based on logical constraints and domain understanding.
14.2 Detecting Extreme Outliers
Candidate extreme outliers can be identified through:
Sorting observations.
Visualizations.
Statistical tests, including z-scores.
Interquartile range methods.
Domain-specific validity limits.
EDA provides the tools for locating unusual observations, but interpretation requires context.
14.3 Options for Handling Outliers
Once an outlier is identified, possible actions include:
Keep the outlier
Appropriate when the value is extreme but real and relevant.
Remove the outlier
Appropriate when it is likely to be an error.
Verify or correct the observation
The preferred option when the original source or measurement can be checked.
Recode the value as missing
Useful when the value is invalid but the instance may still contain useful information.
Transform the data
A logarithmic transformation can reduce the influence of extreme values and may make a strongly non-normal distribution more nearly normal.
Outlier removal should not be driven by a desire to obtain a preferred result. Removing observations based on personal expectations can introduce bias. Removal is also safer when many other independent observations remain available.
Missing Values
15. Missing Outcomes in Supervised Learning
In supervised learning, each training instance generally requires a known outcome label.
If the outcome is missing:
The instance cannot contribute to supervised model training.
The entire instance usually must be removed from the supervised analysis.
A feature-only observation without a known target cannot provide the labeled information required for training or evaluation.
15.1 Missing Feature Values
Missing feature values provide several possible options.
Leave Missing Values Unchanged
If the selected downstream algorithms can handle missing values, the values may be left as they are.
Methods that support missing data may:
Treat missingness as neutral information.
Estimate a value during the modeling process.
Perform “on-the-fly” imputation.
When using this approach, the analyst must understand exactly how the selected algorithms handle missing values.
Remove Features or Instances
A feature or instance containing missing values can be removed.
Removing a feature may be harmful because:
The feature could be important for prediction.
Its absence may discard valuable biological or clinical information.
Removing instances may be harmful because:
Sample size decreases.
Statistical power decreases.
Real associations may become harder to detect.
The remaining observations may become more biased if missingness is systematic.
Nevertheless, removing a feature or instance may be reasonable when missingness is extensive or the data quality is too poor.
Remove Features with Extensive Missingness
A feature with a particularly high frequency of missing values may be too unreliable to retain. Removing such a feature can be preferable to relying on a large number of guesses.
The decision should consider:
The amount of missingness.
The reason values are missing.
The importance of the feature.
Whether the missingness is concentrated in particular groups.
Treat Missingness as Information
Missingness itself may be predictive. For example, a test may be missing because a clinician did not order it, or a questionnaire item may be skipped for a meaningful reason.
An additional engineered feature can indicate whether the original value was missing. This allows the model to distinguish:
A measured value.
A value that was not measured or recorded.
This strategy should be used only when the reason for missingness is meaningful and does not create leakage.
16. Imputation
Imputation is the process of substituting missing values with placeholder or estimated values.
Imputation may be necessary when:
A chosen method cannot process missing values.
Removing features would discard important information.
Removing instances would reduce the sample too substantially.
The analysis requires a complete data matrix.
However, imputation should be used with caution.
At best, imputation is an educated estimate; at worst, it creates manufactured data and introduces bias.
Potential risks include:
Making data appear more certain than they are.
Reducing natural variability.
Creating artificial relationships.
Introducing systematic bias.
Making downstream model performance appear better than justified.
16.1 Single Imputation
Single imputation estimates each missing value using information from other observations for that same feature.
Possible sources of information may include:
The feature’s central tendency.
Other observed values of that feature.
A simple rule based on the feature distribution.
The estimate is inserted as one replacement value.
16.2 Multiple Imputation
Multiple imputation estimates a missing value using many or all available feature values in the dataset.
It can incorporate relationships among variables and may produce more context-sensitive estimates than single-feature methods. The choice between single and multiple imputation depends on the dataset, missingness mechanism, analysis goals, and assumptions.
Data Integration
17. Definition and Purpose
Data integration is the combination of features or instances from different data sources, files, studies, or institutions.
Biomedical research often combines multiple types of data, including:
Environmental data: Lifestyle, socioeconomic, and behavioral information.
Clinical data: Electronic health records, clinical trials, diagnoses, treatments, and outcomes.
Biological data: Biomarkers, laboratory measurements, and biological processes.
Genetic and omics data:
Genome-wide association data.
Whole-exome sequencing.
Whole-genome sequencing.
Gene-expression data.
Epigenetic data.
Other molecular measurements.
These sources may differ in their file formats, storage locations, identifiers, measurement procedures, and institutional ownership.
18. Challenges in Data Integration
18.1 Data Silos
A data silo is a self-contained source of information that is isolated from other sources.
Data silos may occur across:
Departments.
Hospitals.
Research institutions.
Clinical trials.
Laboratory systems.
Separate databases or file systems.
Overcoming data silos may require:
Permission to access the data.
Data-sharing agreements.
Institutional coordination.
Technical processes for transferring and linking records.
Clear rules governing permitted analyses and sharing.
18.2 Unifying File Formats
Data from separate sources may use different:
File types.
Column layouts.
Feature names.
Coding systems.
Data structures.
Missing-value representations.
Before integration, these formats must be converted into a consistent structure.
18.3 Data Harmonization
Data harmonization makes measurements from different sources comparable.
A harmonized dataset should use consistent:
Features.
Feature names.
Value encodings.
Measurement units.
Definitions.
Coding standards.
Data types.
Collection conventions.
For example, two clinical studies may record the same biological measurement using different units or category labels. Harmonization converts them into a common representation so that they can be analyzed together.
18.4 Security and Patient Identifiers
Data integration may require patient identifiers to correctly link records across sources. This creates heightened security requirements during:
Data transfer.
Record linkage.
Temporary storage.
Integration.
Storage of the final dataset.
Access should be restricted, and identifiers should be protected according to applicable privacy and security requirements. Security must be considered both during the integration process and after the integrated dataset is created.
19. Relationship Between EDA and Data Wrangling
EDA and data wrangling are closely connected:
EDA reveals what the data contain and where problems occur.
Data wrangling applies the transformations needed to make the data usable.
Cleaning decisions often require additional EDA.
After wrangling, EDA is repeated to verify that the resulting dataset is coherent.
A practical workflow is therefore iterative rather than strictly linear:
Inspect and summarize the raw data.
Identify errors, missingness, redundancy, imbalance, and unusual patterns.
Format, clean, extract, or integrate the data.
Re-examine the transformed data.
Confirm that the processed dataset matches the original research goal and is suitable for modeling.
The initial preparation stages establish the foundation for later activities such as data splitting and feature processing.

Ask anything
We've read this whole study set, so questions about it get the best answers.