Data Preparation and Statistical InferenceIntroductionMarketing research rarely produces analysis-ready data. Responses may be incomplete, duplicated, inconsistently coded, incorrectly entered, or measured on incompatible scales. Statistical inference then extends conclusions from a sample to a wider population, but only when the data, design, and assumptions support that extension. Data preparation and inference are therefore not separate clerical and mathematical activities: together they determine the credibility of marketing evidence. This chapter presents a disciplined workflow for coding, cleaning, transforming, documenting, visualizing, and analysing research data. It covers missing values, outliers, assumptions, confidence intervals, effect sizes, cross-tabulation, t-tests, chi-square tests, ANOVA, and nonparametric alternatives. The emphasis is on interpretation and managerial judgment rather than mechanical production of p-values. Learning ObjectivesBy the end of this chapter, readers should be able to: - Construct a data dictionary and reproducible data-preparation workflow.
- Code, validate, clean, reshape, and transform marketing-research data.
- Diagnose missingness, outliers, influential observations, and statistical assumptions.
- Select and interpret suitable visualizations and inferential procedures.
- Calculate and explain confidence intervals, hypothesis tests, and effect sizes.
- Apply cross-tabulation, t-tests, chi-square tests, ANOVA, and nonparametric methods.
- Communicate findings with appropriate attention to uncertainty, ethics, and managerial relevance.
1. From Responses to an Analysis DatasetA research dataset should be treated as a documented research instrument, not merely a spreadsheet. A typical rectangular dataset contains one row per observational unit and one column per variable. The unit may be a consumer, household, store, transaction, advertisement, or time period. Mixing units—for example, placing customer-level and store-level observations in the same table without a defined structure—creates invalid analyses. A data dictionary should specify the variable name, label, unit of measurement, response codes, permissible range, source question, missing-value code, and transformation history. For example, a five-point satisfaction item may be coded 1 = very dissatisfied through 5 = very satisfied, while 99 should be reserved for “not answered” and never treated as a genuine score. A reproducible workflow commonly follows this sequence: - Preserve the raw, read-only data.
- Create a working copy and record the file date, source, and software version.
- Inspect structure, labels, ranges, duplicates, and unique identifiers.
- Recode variables using documented rules.
- Diagnose missingness, outliers, and logical inconsistencies.
- Transform variables only when theoretically justified.
- Conduct descriptive and inferential analysis.
- Export an analysis dataset, syntax or code, and a data-preparation log.
Data validation rules should reflect the questionnaire and sampling design. If age is recorded in years, values below 0 or above a defensible upper limit require investigation. If a respondent indicates “does not own a loyalty card,” a later question asking frequency of loyalty-card use may legitimately be structurally missing rather than an error. Coding decisionsCategorical variables can be represented by labels, but numerical codes do not automatically create numerical meaning. Codes 1, 2, and 3 for brand categories are nominal. Computing their mean is meaningless. Ordinal responses have an order, but distances between categories may not be equal. Interval or ratio measures support more extensive arithmetic, subject to their substantive meaning and distribution. Reverse-coded items require careful attention. For a scale from 1 to 5, the reverse score is: xᵣ = (L + U) − x where x is the original response, L is the lowest scale value, U is the highest scale value, and xᵣ is the reversed response. Thus, a response of 2 becomes 4 when L = 1 and U = 5. The formula assumes a complete, correctly coded scale; a missing code must not be reversed into a valid score. 2. Missing DataMissingness may arise from refusal, interviewer error, skip patterns, technical failure, or inapplicability. Three conceptual mechanisms are useful: - Missing completely at random (MCAR): missingness is unrelated to observed and unobserved values.
- Missing at random (MAR): missingness depends on observed variables after those variables are controlled.
- Missing not at random (MNAR): missingness depends on the unobserved value itself or on unmeasured factors.
These mechanisms cannot usually be proven from the dataset alone. They are assessed through study knowledge, response patterns, comparisons of respondents and nonrespondents, and sensitivity analysis. The percentage missing for variable j is: pⱼ = (mⱼ / n) × 100 where mⱼ is the number of missing observations for variable j and n is the number of eligible observations. Percentages should distinguish true missingness from legitimate “not applicable” responses. Common treatments include complete-case analysis, available-case analysis, single imputation, multiple imputation, and model-based methods. Complete-case analysis is simple but can reduce power and create bias when cases are not MCAR. Mean imputation distorts variance and relationships and should not be used automatically. Multiple imputation creates several plausible datasets, analyses each, and combines estimates so that uncertainty about missing values is retained. A defensible report states the amount and pattern of missingness, the treatment applied, the number of cases in each analysis, and whether results changed under plausible alternatives. 3. Outliers, Influential Cases, and Data QualityAn outlier is an observation unusual relative to a variable or model. It may indicate an entry error, a valid extreme consumer, a sampling problem, or a mixture of populations. It should never be deleted merely because it weakens statistical significance. For a univariate variable, a standardized score is: zᵢ = (xᵢ − x̄) / s where xᵢ is an observation, x̄ is the sample mean, and s is the sample standard deviation. Large absolute values can flag unusual observations, but no universal cutoff proves that a case is erroneous. A robust alternative uses the interquartile range (IQR): observations below Q₁ − 1.5IQR or above Q₃ + 1.5IQR are commonly flagged, where IQR = Q₃ − Q₁. Multivariate outliers may be detected using Mahalanobis distance: D² = (x − μ)ᵀΣ⁻¹(x − μ) where x is the observation vector, μ is the vector of means, Σ is the covariance matrix, and T and −1 denote transpose and inverse. This method assumes a meaningful covariance structure and is sensitive to non-normality and contaminated estimates. Outliers should be investigated through source records, timestamps, respondent eligibility, and substantive plausibility. Analysts should compare results with and without influential cases, report the rule used, and preserve the original data. 4. Transformation and Scale ConstructionTransformations may address skewness, unequal variance, or nonlinear relationships. A logarithmic transformation, such as ln(x), is appropriate only for positive values and changes interpretation: differences on the log scale correspond approximately to proportional differences on the original scale. Square-root transformations can be useful for count data. Transformations should be selected for a statistical or theoretical reason, not simply to obtain a desired p-value. Composite scales require evidence that items represent a common construct. Researchers should inspect item wording, reverse-code where necessary, examine inter-item relationships, and evaluate reliability. Cronbach’s alpha is often reported, but a high alpha can reflect redundant items and does not establish unidimensionality. Factor analysis, theoretical justification, and construct validity are also relevant. A documented transformation log should record the original variable, new variable, formula, rationale, analyst, and date. Derived variables must not overwrite source variables. 5. Descriptive Analysis and VisualizationDescriptive statistics summarize the observed sample. Frequencies and proportions suit categorical variables; the mean and standard deviation are useful for approximately symmetric interval or ratio variables; the median and IQR are more resistant to skew and extreme values. The sample mean and sample variance are: x̄ = (1/n)∑ᵢ₌₁ⁿxᵢ s² = [∑ᵢ₌₁ⁿ(xᵢ − x̄)²] / (n − 1) The denominator n − 1 provides the usual unbiased estimator of population variance under random sampling assumptions. It does not correct a biased sampling design. Use bar charts for categorical comparisons, histograms or density plots for distributions, boxplots for group comparisons, scatterplots for associations, and line charts for ordered time observations. Graphs should show denominators, units, uncertainty where appropriate, and meaningful labels. Truncated axes can exaggerate differences, while excessive decoration obscures evidence. 6. Statistical InferenceInference uses sample information to estimate population quantities or evaluate hypotheses. A parameter describes a population; a statistic describes a sample. A confidence interval gives a range of parameter values compatible with the data and the procedure’s assumptions. It is not correct to say that a 95% confidence interval gives a 95% probability that the fixed parameter lies in this particular interval. In repeated sampling, approximately 95% of intervals constructed by the method would contain the parameter if assumptions hold. For a mean with a large sample or known population standard deviation, a normal-based interval is: x̄ ± z* (s/√n) where x̄ is the sample mean, s is the sample standard deviation, n is sample size, and z* is the relevant standard-normal critical value. When σ is unknown and the population is reasonably normal, the t-based interval is: x̄ ± t*₍ₙ₋₁₎ (s/√n) where t*₍ₙ₋₁₎ is the critical value from a t distribution with n − 1 degrees of freedom. The standard error s/√n measures sampling variability, not the standard deviation of individual observations. Hypothesis testing begins with a null hypothesis H₀ and an alternative hypothesis H₁. A p-value is the probability, assuming H₀ and the model are true, of obtaining a result at least as extreme as the observed result. It is not the probability that H₀ is true, nor a measure of practical importance. Statistical significance depends on effect size, sample size, variability, and the decision threshold. A two-sided test of a mean may use: t = (x̄ − μ₀) / (s/√n) where μ₀ is the null-hypothesized population mean. The test requires independent observations and, especially in small samples, a reasonably normal outcome distribution. Effect sizes complement p-values. For a one-sample or paired comparison, Cohen’s d is often: d = (x̄₁ − x̄₂) / sₚ where sₚ is a pooled standard deviation for independent groups. For paired data, the standard deviation of the within-person differences is generally used instead. Interpretation depends on context; conventional labels such as small, medium, and large are not universal managerial thresholds. Confidence intervals around effects are preferable to isolated point estimates. 7. Cross-Tabulation and Chi-Square AnalysisA cross-tabulation displays the joint distribution of two categorical variables. Row percentages answer questions about the composition of each row; column percentages answer a different question. The denominator must be stated. The Pearson chi-square statistic for a contingency table is: χ² = ∑ᵢ∑ⱼ (Oᵢⱼ − Eᵢⱼ)² / Eᵢⱼ where Oᵢⱼ is the observed count and Eᵢⱼ is the expected count in cell i,j. Under independence: Eᵢⱼ = (row totalᵢ × column totalⱼ) / grand total The degrees of freedom are (r − 1)(c − 1), with r rows and c columns. Expected counts should be sufficiently large for the chi-square approximation; sparse tables may require category combination, an exact test, or a model designed for sparse data. A significant result indicates association, not causation. Cramér’s V can describe association strength: V = √[χ² / (n × min(r − 1, c − 1))] 8. Comparing Means: t-TestsAn independent-samples t-test compares two group means. The equal-variance version uses a pooled variance, but when group variances differ, Welch’s t-test is generally preferable. The analysis requires a quantitative outcome, independent groups, and attention to skew, outliers, and unequal sample sizes. For paired observations, calculate each difference dᵢ and test whether the mean difference differs from zero: t = d̄ / (sd/√n) where d̄ is the mean difference, s_d is its sample standard deviation, and n is the number of complete pairs. Pairing is powerful only when observations are genuinely linked, such as the same customers measured before and after a campaign. If many outcomes or groups are tested, the chance of at least one false positive increases. Analysts should pre-specify primary comparisons, adjust for multiplicity when appropriate, and distinguish exploratory from confirmatory findings. 9. ANOVA and Multiple GroupsOne-way analysis of variance tests whether three or more population means are equal. It partitions total variability into between-group and within-group components: F = MSᵦ / MS𝓌 where MSᵦ is mean square between groups and MS𝓌 is mean square within groups. For k groups and total sample size N, degrees of freedom are k − 1 between groups and N − k within groups. A significant omnibus F-test indicates that not all means are equal, but does not identify which groups differ. Post-hoc comparisons, such as Tukey’s method, should control familywise error. ANOVA assumes independent observations, approximately normal residuals, and reasonably similar variances. It is often robust to moderate non-normality with balanced groups, but serious heteroscedasticity may require Welch ANOVA. Effect sizes include eta squared: η² = SSᵦ / SSₜ where SSᵦ is between-group sum of squares and SSₜ is total sum of squares. Partial eta squared is common in factorial designs but should not be confused with eta squared. 10. Nonparametric MethodsNonparametric procedures are useful when measurement is ordinal, distributions are strongly skewed, samples are small, or assumptions of parametric tests are untenable. They are not assumption-free. - Mann–Whitney U: compares two independent groups using ranks; interpretation concerns distributions or stochastic dominance, not automatically means or medians.
- Wilcoxon signed-rank: compares paired differences using ranks and generally assumes symmetric differences for a location interpretation.
- Kruskal–Wallis: compares three or more independent groups; significant results require suitable post-hoc rank comparisons.
- Friedman test: compares three or more related conditions using ranks.
- Spearman’s rho: measures monotonic association using ranks.
Permutation and bootstrap methods provide flexible inference by resampling under an appropriate design. A bootstrap confidence interval estimates sampling uncertainty, but resampling cannot repair biased sampling, poor measurement, or dependence that was ignored in the resampling scheme. 11. Assumption Diagnosis and Responsible InterpretationAssumptions should be diagnosed using design knowledge, plots, residuals, and substantive reasoning—not only significance tests. Formal normality tests can flag trivial departures in large samples and miss important departures in small samples. Examine residual-versus-fitted plots, Q–Q plots, group spreads, independence, and influential cases. Independence is primarily a design issue. Repeated observations from the same customer, stores within regions, or respondents recruited through the same site may be correlated. Clustered or longitudinal data may require multilevel, generalized estimating-equation, or repeated-measures models rather than ordinary tests. Report estimates, confidence intervals, effect sizes, sample sizes, assumptions, missing-data treatment, and the exact comparison. Avoid causal language for observational associations unless the design and identification strategy justify it. Statistical significance should be integrated with cost, customer impact, operational feasibility, and uncertainty. 12. Illustrative Case: Evaluating a Loyalty-App CampaignBackground. A retailer introduces a loyalty-app message intended to increase monthly spending. An illustrative sample contains 240 eligible customers: 120 receive the message and 120 form a comparison group. Spending is recorded for the month after the campaign. Problem. Management wants to know whether the campaign produced a meaningful increase, whether effects differ by age group, and whether app adoption is associated with campaign assignment. Analysis. The analyst first verifies one row per customer, checks eligibility, identifies 7 missing spending values, and confirms that missingness is more common among customers with low prior activity. Because this pattern challenges MCAR, the analyst reports complete-case results and a sensitivity analysis using multiple imputation based on prior spending, age, and assignment. Spending is right-skewed, so medians and boxplots supplement means. Extreme values are traced to legitimate bulk purchases and retained. Welch’s t-test estimates the difference in mean spending with a confidence interval and Cohen’s d. A Mann–Whitney analysis provides a rank-based sensitivity check. A cross-tabulation of assignment by app adoption uses row percentages and Pearson’s chi-square test; Cramér’s V describes association strength. A two-way model examines campaign assignment, age group, and their interaction, while residual plots assess variance and model fit. Approach and decision. The campaign is recommended only if the estimated increase is sufficiently precise and economically meaningful, not merely statistically significant. If assignment was randomized, causal language is appropriate subject to implementation integrity. If customers self-selected into exposure, the results should be described as adjusted association unless a credible causal design is available. Learning points. Data preparation revealed informative missingness, descriptive plots prevented overreliance on means, sensitivity analyses tested robustness, and effect sizes connected statistical output to managerial value. The case also illustrates why an analysis plan should be linked to the research design before examining results. 13. Ethics, Governance, and TechnologyResearchers must protect confidentiality, minimize unnecessary collection, restrict access, and document lawful and ethical purposes. Identifiers should be separated from analysis variables where possible. Reports should avoid re-identification through small cells, especially when cross-tabulations involve sensitive characteristics. Data retention, consent, withdrawal rights, and applicable privacy regulations must be addressed. Statistical software and AI-assisted coding can accelerate data checks, visualization, and code generation, but outputs require human verification. Analysts should not upload identifiable customer data to unapproved systems. AI-generated transformations may silently change missing codes, reverse scales incorrectly, or reproduce biased assumptions. Reproducible scripts, version control, audit logs, and independent review are essential. Best-Practice Checklist- Preserve raw data and maintain a data dictionary.
- Define units, codes, eligibility, and missing-value rules before analysis.
- Inspect distributions and denominators before selecting tests.
- Investigate, do not automatically delete, unusual observations.
- Match the method to measurement level and research design.
- Report estimates, intervals, effect sizes, assumptions, and sample sizes.
- Distinguish statistical association from causation.
- Conduct sensitivity analyses for missing data and influential cases.
- Control multiplicity when many comparisons are made.
- Protect privacy and make every transformation reproducible.
Chapter SummaryData preparation establishes the validity of statistical inference. A defensible workflow preserves raw data, documents coding, validates ranges and logical relationships, diagnoses missingness and unusual cases, and records every transformation. Visualization and descriptive statistics reveal distributional features that summary numbers may conceal. Confidence intervals communicate precision, while hypothesis tests assess compatibility with a null model. P-values do not measure practical importance or prove hypotheses. Effect sizes and interval estimates should therefore accompany significance tests. Cross-tabulation and chi-square procedures address categorical variables; t-tests compare two means; ANOVA compares several means; and nonparametric methods provide rank-based alternatives when measurement or distributional conditions warrant them. Every method depends on design and assumptions, especially independence. Graduate-level marketing research requires more than selecting a software command. It requires connecting the research question, measurement scale, sampling design, data quality, statistical model, uncertainty, and managerial decision. Ethical governance, privacy protection, reproducibility, and transparent reporting are integral components of credible evidence. Key TermsData dictionary: Documentation describing variables, codes, units, and data rules. Data validation: Checking whether observations satisfy predefined structural and substantive rules. Missing completely at random (MCAR): Missingness unrelated to observed or unobserved values. Missing at random (MAR): Missingness related to observed variables after conditioning on them. Missing not at random (MNAR): Missingness related to unobserved values or unmeasured factors. Outlier: An unusually extreme observation relative to a variable or model. Influential observation: A case whose presence substantially changes an estimate or conclusion. Transformation: A mathematically or substantively justified change to a variable’s representation. Confidence interval: An interval produced by a procedure with a stated long-run coverage rate. Standard error: An estimate of the sampling variability of a statistic. Null hypothesis: A formal statement used as the reference model in a test. p-value: The probability, under the null model, of a result at least as extreme as observed. Effect size: A measure of the magnitude of a difference or association. Cross-tabulation: A table showing the joint distribution of categorical variables. Chi-square test: A test commonly used for association between categorical variables. Welch’s t-test: A two-group mean comparison that does not require equal variances. ANOVA: A framework partitioning variability to compare several group means. Nonparametric method: A procedure relying less directly on a specified population distribution, often using ranks. Reproducibility: The ability to recreate results from documented data, code, and procedures. Review QuestionsShort Answer Questions- Why should numerical category codes not automatically be treated as quantitative measurements?
- Distinguish MCAR, MAR, and MNAR missingness.
- What does a p-value represent, and what does it not represent?
- When is a paired t-test more appropriate than an independent-samples t-test?
- Why should effect sizes accompany significance tests?
Long Answer Questions- Design a complete data-preparation workflow for a consumer-survey dataset, including documentation and quality checks.
- Explain how missing values and outliers can bias marketing conclusions, and compare appropriate remedies.
- Compare chi-square tests, t-tests, ANOVA, and nonparametric alternatives in terms of research question, measurement, and assumptions.
- Explain the meaning and limitations of a 95% confidence interval and a statistically significant result.
- Discuss how privacy, reproducibility, and AI-assisted analytics affect the governance of marketing research data.
Analytical / Application Questions- A retailer records satisfaction on a five-point scale for customers exposed and not exposed to an advertisement. Propose an analysis plan, including visualization, missing-data diagnosis, group comparison, effect size, and reporting.
- A cross-tabulation shows campaign assignment by app adoption, but several expected cell counts are small. Diagnose the problem and recommend an appropriate analytical response.
- A three-group campaign test produces a significant ANOVA F-test, but group variances differ substantially and spending is heavily skewed. Evaluate the standard analysis and propose a robust alternative and sensitivity analysis.
Multiple Choice Questions with AnswersQuestion 1Which practice best supports reproducible data preparation? A. Overwriting raw variables with corrected values B. Maintaining a data dictionary, transformation log, and original raw file C. Deleting all unusual observations before analysis D. Reporting only the final p-value Correct Answer: B. Maintaining a data dictionary, transformation log, and original raw file Question 2Which statement correctly describes a p-value? A. The probability that the null hypothesis is true B. The probability that the research hypothesis is true C. The probability, under the null model, of a result at least as extreme as observed D. The magnitude of the practical effect Correct Answer: C. The probability, under the null model, of a result at least as extreme as observed Question 3For a five-point item coded from 1 to 5, what is the reverse-coded value of 2? A. 1 B. 2 C. 4 D. 5 Correct Answer: C. 4 Question 4What does Cramér’s V primarily describe? A. The strength of association between categorical variables B. The difference between two means C. The standard error of a mean D. The normality of residuals Correct Answer: A. The strength of association between categorical variables Question 5Which test is designed for comparing the means of two independent groups without assuming equal variances? A. Paired t-test B. Welch’s t-test C. Friedman test D. Chi-square goodness-of-fit test Correct Answer: B. Welch’s t-test Question 6A significant one-way ANOVA F-test establishes that: A. Every group mean differs from every other group mean B. The largest group has the highest population mean C. At least one population mean differs from another D. The treatment caused the observed differences Correct Answer: C. At least one population mean differs from another Question 7Which method is most directly appropriate for three related conditions measured on the same respondents when parametric assumptions are doubtful? A. Friedman test B. Independent-samples t-test C. Pearson chi-square test D. One-sample z-test Correct Answer: A. Friedman test Question 8What is the main concern with treating a missing response code of 99 as a genuine survey score? A. It increases the sample’s representativeness B. It can distort descriptive statistics and model estimates C. It guarantees normality D. It converts an ordinal variable into a nominal variable Correct Answer: B. It can distort descriptive statistics and model estimates Question 9In a confidence interval for a mean, s/√n represents: A. The population mean B. The sample variance C. The estimated standard error of the mean D. The critical value Correct Answer: C. The estimated standard error of the mean Question 10Why should a legitimate extreme purchase not automatically be deleted? A. All extreme values are errors B. Deletion always increases validity C. It may represent a real segment or event and deletion can bias results D. Outliers cannot affect statistical estimates Correct Answer: C. It may represent a real segment or event and deletion can bias results
|