This prompt template provides a systematic framework for conducting comprehensive data analysis projects. It guides analysts through hypothesis formulation, data exploration, statistical testing, and result interpretation phases. The template includes predefined variables for customizing analysis scope, data types, and output requirements. Users can adapt this framework for various domains including business intelligence, research, and machine learning preprocessing. The narrative body explains the analytical approach, includes concrete worked examples, and outlines limitations and validation techniques.
Data Exploration and Preparation
Once hypotheses are defined, the template guides users through systematic data exploration. This includes comprehensive univariate analysis to understand individual variable distributions, bivariate analysis to identify relationships between key variables, and multivariate techniques to detect complex interaction patterns. Data cleaning procedures are specified for handling missing values, outliers, and ensuring data quality standards. Analysts should document all transformations and verify data integrity before proceeding to statistical testing.
Univariate analysis involves examining the distribution of each variable independently. For continuous variables, analysts should calculate measures of central tendency including mean, median, and mode, along with measures of dispersion such as standard deviation, variance, range, and interquartile range. Visualizations including histograms, box plots, and density plots provide intuitive understanding of distribution shape, skewness, and potential outliers. For categorical variables, frequency tables, bar charts, and proportion calculations reveal category distributions and potential class imbalance issues.
Bivariate analysis explores relationships between pairs of variables. Correlation analysis using Pearson correlation for continuous variables and Spearman correlation for ranked or non-normal data quantifies linear and monotonic relationships respectively. For categorical-continuous variable pairs, t-tests or ANOVA assess group differences. Categorical-categorical relationships are examined using chi-square tests of independence and contingency tables. Visualization techniques including scatter plots, grouped box plots, and mosaic plots provide visual confirmation of statistical findings.
Multivariate techniques extend analysis to three or more variables simultaneously. Principal component analysis and factor analysis reduce dimensionality while preserving variance structure. Cluster analysis identifies natural groupings within the data. Multiple regression models examine the simultaneous effect of multiple predictors on an outcome variable. These techniques require careful consideration of sample size adequacy, multicollinearity diagnostics, and assumption verification.
Statistical Analysis and Testing
The template provides frameworks for appropriate statistical testing based on data characteristics and research questions. For normally distributed continuous variables, parametric tests like t-tests and ANOVA are recommended. For non-normal data or categorical variables, non-parametric alternatives such as Mann-Whitney U tests and chi-square analysis are suggested. Effect size calculations and confidence interval estimation are integrated throughout the analytical process. Each test requires verification of assumptions including normality, homogeneity of variance, and independence of observations.
Parametric testing begins with assumption verification. Normality assessment uses Shapiro-Wilk tests for small samples and visual inspection of Q-Q plots for larger samples. Homogeneity of variance is evaluated using Levene's test or Bartlett's test. Independence is typically ensured through study design. When assumptions are met, independent samples t-tests compare two group means, paired t-tests assess within-subject changes, and one-way ANOVA extends comparison to three or more groups. Two-way ANOVA examines main effects and interactions between two categorical predictors.
Non-parametric alternatives provide robust testing when parametric assumptions are violated. The Mann-Whitney U test replaces the independent samples t-test for comparing two independent groups with ordinal or non-normal data. The Wilcoxon signed-rank test serves as the paired t-test alternative. Kruskal-Wallis testing extends to three or more independent groups. These tests compare medians rather than means and are less sensitive to outliers and distributional assumptions.
Categorical data analysis employs chi-square tests of independence for contingency tables larger than 2x2, with Fisher's exact test recommended for small expected cell frequencies. Effect sizes for categorical data include Cramér's V for nominal variables and odds ratios for 2x2 tables. Post-hoc pairwise comparisons with appropriate corrections identify specific group differences following significant omnibus tests.
Result Interpretation and Validation
Analysis concludes with systematic result interpretation following statistical significance testing. Each finding requires contextual interpretation within the domain, consideration of practical significance beyond statistical significance, and identification of limitations. Cross-validation techniques are recommended to ensure result robustness, including sensitivity analysis and alternative model specification testing. Findings should be validated with domain experts and, when possible, cross-referenced with alternative analytical approaches.
Practical significance assessment examines whether statistically significant effects are large enough to matter in real-world contexts. Effect sizes provide standardized measures independent of sample size. Cohen's d quantifies mean differences, Pearson's r measures correlation strength, and eta-squared indicates variance explained in ANOVA. Confidence intervals convey precision and uncertainty around point estimates. Clinical or business significance thresholds should be established a priori based on domain expertise.
Template Variables and Usage
This template includes configurable variables for adapting to specific analysis needs:
- analysisScope: Define the breadth of analysis (exploratory vs. confirmatory)
- dataTypes: Specify primary data types (quantitative, qualitative, mixed)
- domainFocus: Target application area (healthcare, finance, technology, etc.)
- outputFormat: Desired deliverable format (statistical report, visualization, dashboard)
- sampleSize: Expected or actual participant/sample size considerations
- confidenceLevel: Statistical significance threshold (typically 0.05)
Worked Example: Customer Satisfaction Analysis
Consider analyzing customer satisfaction survey data from a technology company. Using this template, an analyst would first establish hypotheses about factors influencing satisfaction scores. Data would be explored for response patterns, missing values, and demographic correlations. Statistical tests would identify significant predictors of satisfaction, with regression analysis revealing the relative importance of service quality, product features, and support interactions. Results would be interpreted in business context, providing actionable recommendations for service improvement.
The customer satisfaction example demonstrates the complete workflow. Initial hypotheses might predict that service quality and product features both positively influence satisfaction scores, with service quality having a stronger effect. Data exploration reveals satisfaction scores are approximately normally distributed with mean 7.2 on a 10-point scale. Service quality correlates at r = 0.58 with satisfaction, while product features correlate at r = 0.42. Multiple regression controlling for both predictors simultaneously shows service quality remains significant (β = 0.45, p < 0.001) while product features become non-significant (β = 0.18, p = 0.07), suggesting service quality mediates the product features effect.
Implementation Guidelines
This template provides a systematic framework but requires adaptation to specific contexts. Analysts must consider ethical implications, data privacy regulations, and appropriate sample size justification. The template assumes basic statistical literacy and access to analysis software. Results should always be validated with domain experts and, when possible, cross-referenced with alternative analytical approaches. For reference, see the existing prompt Sandwich Pattern for Prompt Injection Defense which demonstrates structured prompt design principles.
Code Example
def analyze_customer_satisfaction(data):
# Data cleaning and preprocessing
cleaned_data = data.dropna(subset=['satisfaction_score', 'service_quality', 'product_features'])
# Descriptive statistics
summary_stats = cleaned_data.describe()
# Correlation analysis
correlation_matrix = cleaned_data.corr()
# Regression modeling
import statsmodels.api as sm
X = cleaned_data[['service_quality', 'product_features']]
y = cleaned_data['satisfaction_score']
X = sm.add_constant(X)
model = sm.OLS(y, X).fit()
# Results interpretation
print(model.summary())
return model.params
Quality Assurance
- Verify statistical assumptions before test selection
- Check for multiple comparison issues and apply corrections
- Document all analytical decisions and data transformations
- Validate findings with domain expert review
- Ensure reproducibility through complete documentation
End analysis when all hypothesis tests are completed and validated.
Prompt template
You are an expert data analyst conducting a comprehensive analysis project. Follow this structured methodology:
## Analysis Workflow
1. **Problem Definition**
- Clearly define the research question: [analysisScope]
- Formulate specific, testable hypotheses based on domain knowledge
- Identify key variables and expected relationships
2. **Data Assessment**
- Evaluate data availability and quality for [dataTypes] data
- Assess sample size: [sampleSize] participants/units
- Check for missing values, outliers, and data completeness
3. **Exploratory Analysis**
- Conduct univariate analysis for each variable
- Perform bivariate analysis to identify relationships
- Apply multivariate techniques for complex interactions
4. **Statistical Testing**
- Select appropriate tests based on data distribution
- For normally distributed continuous data: Use t-tests, ANOVA, Pearson correlation
- For non-normal data: Use Mann-Whitney U, Kruskal-Wallis, Spearman correlation
- For categorical data: Apply chi-square tests, Fisher's exact test
- Calculate effect sizes and confidence intervals
5. **Interpretation and Validation**
- Interpret results within [domainFocus] context
- Consider practical significance beyond statistical significance
- Identify limitations and alternative explanations
- Perform cross-validation and sensitivity analysis
## Variables and Parameters
**Analysis Scope**: [analysisScope]
**Data Types**: [dataTypes]
**Domain Focus**: [domainFocus]
**Output Format**: [outputFormat]
**Sample Size**: [sampleSize]
**Confidence Level**: [confidenceLevel]
## Example Implementation
Input:
- Research Question: How does [variableX] affect [variableY] in [domainContext]?
- Expected Relationship: Positive/Correlated/Negative
- Data Sample: [sampleSize] observations
- Key Predictors: [variable1], [variable2], [variable3]
Analysis Steps:
1. Clean and preprocess the dataset
2. Conduct descriptive statistics and visualization
3. Test hypothesis H0: [nullHypothesis] vs H1: [alternativeHypothesis]
4. Perform regression/correlation analysis as appropriate
5. Validate results with cross-validation techniques
6. Report findings with effect sizes and confidence intervals
## Quality Assurance
- Verify statistical assumptions before test selection
- Check for multiple comparison issues and apply corrections
- Document all analytical decisions and data transformations
- Validate findings with domain expert review
- Ensure reproducibility through complete documentation
## Reporting Requirements
Deliverables:
- Statistical analysis report with tables and figures
- Interpretation of practical significance
- Limitations and alternative explanations
- Recommendations based on findings
- Code/documentation for reproducibility
End analysis when all hypothesis tests are completed and validated.