Week 06

Week 06 · Marketing Research & Analytics

Data Preparation and Descriptive Analysis

Davood Wadi, PhD

The validity of an analysis depends on the preparation of the data on which it is performed.

The Data Preparation Process

Data preparation converts the raw responses collected in the field into a dataset suitable for analysis.

  1. The researcher first checks the responses for completeness and for the data quality criteria specified before data collection, introduced in Week 5.

  2. The researcher then codes the responses and records them in a data matrix.

  3. The researcher then cleans the data, correcting or removing errors and inconsistencies.

  4. The researcher then treats missing values and, where necessary, applies statistical adjustments such as weighting.

  5. Finally, the researcher selects the analysis strategy, according to the research questions and the level of measurement of each variable.

Exercise · Put it in order

A hotel group has just closed its guest survey. Put the analyst's data preparation steps in order.

Tap a step, then the number where it belongs.

Coding and the Data Matrix

Coding is the assignment of a numeric code to each possible response, such as 1 for “strongly disagree” through 5 for “strongly agree.”

A codebook records, for each variable, its name, the question from which it derives, its codes and their meanings, its level of measurement, and the code used for missing values.

Open-ended responses are coded into categories through the coding procedures introduced in Week 3.

A multiple-response question, in which respondents may select several options, is coded as a separate variable for each option, with 1 indicating selection and 0 indicating no selection.

The coded data are arranged in a data matrix, in which each row represents a respondent and each column represents a variable.

Respondent 3's questionnaire: a rating of 4 on a five-point scale, and a multiple-response question with Website and Store selected and App not selected. In the data matrix, row 3 reads ID 3, Q1 4, Q2_WEB 1, Q2_APP 0, Q2_STORE 1; each row is a respondent and each column a variableQ1123454Q2Website1App0Store1VARIABLES →IDQ1Q2_WEBQ2_APPQ2_STORE1511022011341014311154001↓ RESPONDENTS

Data Cleaning

Data cleaning is the identification and treatment of errors in the data matrix.

  1. Out-of-range values are values that are not permitted by the codebook, such as a 7 on a five-point scale.

  2. Logical inconsistencies are combinations of answers that cannot both be true, such as a respondent who reports never having used a service but rates its customer support.

  3. Extreme values, or outliers, are values far from the rest of the distribution, such as a reported monthly spending of 90,000 dollars at a coffee chain. They are investigated before any decision is taken to correct, retain, or remove them.

Six rows of a data matrix under the codebook's permitted codes. Respondent 2 has a satisfaction of 7 where the codes run from 1 to 5, an out-of-range value; respondent 4 reports never having used support but rates it 4, a logical inconsistency; respondent 5 reports monthly spending of 90,000 dollars while the others report 12 to 41, an extreme valueIDSATISFACTIONCODES 1–5USED SUPPORT0 NEVER · 1 YESSUPPORT RATINGCODES 1–5MONTHLY SPENDINGDOLLARS141432271318OUT-OF-RANGE VALUE351525420412LOGICAL INCONSISTENCY531290,000EXTREME VALUE641441

Every change made during cleaning is documented, so that the analysis can be reproduced.

Missing Values

Missing values occur when respondents do not answer a question, or when an answer is removed during cleaning.

Missing values are least problematic when they occur at random. They are most problematic when the likelihood of a missing answer is related to the answer itself, as when respondents with high incomes are more likely to decline to report their income.

  1. In casewise deletion, respondents with any missing value are excluded from the analysis, which can substantially reduce the sample size.

  2. In pairwise deletion, each calculation uses all respondents with complete data for the variables involved, so that different statistics are based on different respondents.

  3. In mean substitution, each missing value is replaced by the mean of the variable, which preserves the sample size but understates the variability of the data.

  4. In model-based imputation, missing values are estimated from the respondent's other answers. The method selected and the extent of missing data are reported.

Twenty respondents answer four questions, with twelve answers missing. Under casewise, the columns rest on 9, 9, 9, 9 respondents, and income has a mean of 53 thousand dollars and a standard deviation of 14.7, from 9 valuesINCOMEAGESATISF.VISITS4231465545343826595842614923474572523461135245105844544334633266502340294852365543493857056324754332349999NINCOME, $ THOUSANDSN9MEAN53SD14.7±1 SD20406080100120
Treatment
Exercise · Which one is it?

Each case describes how an analyst handled missing answers. Name the method.

A survey of 800 members is analysed on only 470, because every member who skipped any of the twelve questions is left out.

Which concept does this case show?

Weighting

Weighting assigns each respondent a weight so that the sample matches the population on known characteristics, such as age, gender, and region.

For example, if women represent 51 percent of the population but 40 percent of the sample, each woman in the sample receives a weight greater than one.

Women are 51 percent of the population and 40 percent of a sample of 500. Each woman receives a weight of 1.27 and each man 0.82, drawn as the heights of twenty respondents. The margin of error of the weighted estimate is plus or minus 4.5 points, against 4.4 without weightingPOPULATION51% WOMENSAMPLE OF 50040% WOMENWEIGHT 1.27WEIGHT 0.82MARGIN OF ERRORUNWEIGHTED ±4.4WEIGHTED ±4.5
40
  1. Population figures for weighting are drawn from reliable secondary sources, such as a census.

  2. Weighting can reduce the effect of nonresponse error on the weighted characteristics, but it cannot correct differences between respondents and nonrespondents on characteristics that were not used in the weighting.

  3. Large weights increase the variability of estimates, and the weighting procedure is therefore reported.

Part 2: Descriptive Analysis

Descriptive analysis summarizes the characteristics of the sample, one variable at a time.

It is the first stage of any analysis, and it also reveals errors that remained after cleaning.

The appropriate statistics depend on the level of measurement of each variable, introduced in Week 4.

Frequency Distributions

  1. A frequency distribution reports the number and the percentage of respondents who gave each response to a question.

  2. Valid percentages are calculated on the respondents who answered the question, excluding missing values.

  3. Cumulative percentages report the percentage of respondents at or below each value, such as the percentage of customers who visited three times or fewer.

A histogram displays the frequency distribution of a quantitative variable, and reveals its shape, including skewness and extreme values.

Store visits in the past month by 200 customers, 10 of whom did not answer. The table gives the number, percentage, valid percentage and cumulative percentage for each value: 72.1 percent of those who answered visited three times or fewer. The histogram of the same data peaks at two visits, trails off to the right, and has an extreme value of two customers at twenty visitsVISITSN%VALID %CUMULATIVE %0147.07.47.413819.020.027.424422.023.250.534120.521.672.142211.011.683.75136.56.890.5684.04.294.7752.52.697.4831.51.698.92021.01.1100.0No answer105.0200100.0100.072.1% AT 3 OR FEWEREXTREME VALUE05101520VISITS IN THE PAST MONTH

Measures of Central Tendency

  1. The mode is the most frequently occurring value, and is the only measure of central tendency appropriate for nominal data.

  2. The median is the value that divides the ordered distribution into two equal halves, and is appropriate for ordinal data and for skewed distributions.

  3. The mean is the arithmetic average, and is appropriate for interval and ratio data.

In a skewed distribution, the mean is drawn toward the extreme values. For example, if a small number of customers spend very large amounts, the mean monthly spending may be 80 dollars while the median is 35 dollars.

Monthly spending of twenty customers: seventeen spend between 12 and 60 dollars, and three heavy spenders spend 280, 340, 420 dollars. The median is 35 dollars and the mean 80 dollarsMEDIAN$35MEAN$80$0$100$200$300$400$500$600MONTHLY SPENDING

For skewed variables such as income and spending, the median therefore describes the typical respondent more accurately than the mean.

Measures of Dispersion

Measures of dispersion describe how widely values are spread around the center of the distribution.

  1. The range is the difference between the largest and the smallest values, and is highly sensitive to extreme values.

  2. The interquartile range is the range of the middle 50 percent of values, and is not affected by extreme values.

  3. The variance is the average squared deviation from the mean, and the standard deviation is its square root, expressed in the original units of the variable.

Two brands may each have a mean satisfaction rating of 4.0, one with a standard deviation of 0.5 and the other with a standard deviation of 1.5. Customers' evaluations of the second brand are considerably more dispersed than those of the first.

Twenty-four customers rate two brands from 1 to 5. Both have a mean of 4.0. The first brand's ratings are almost all 4, with a standard deviation of 0.5; the second brand's run from 1 to 5, with a standard deviation of 1.5MEAN 4.0SD 0.5MEAN 4.0SD 1.512345RATING

Selecting Descriptive Statistics

  • For a nominal variable, such as preferred store, the analysis reports the frequency distribution and the mode.

  • For an ordinal variable, such as the ranking of brands, the analysis reports the frequency distribution, the median, and percentiles.

  • For an interval or ratio variable with a symmetric distribution, such as a rating averaged across several items, the analysis reports the mean and the standard deviation.

  • For a ratio variable with a skewed distribution, such as annual spending, the analysis reports the median and the interquartile range, together with the mean where appropriate.

Exercise · Match up

Match each variable with the statistics the analysis reports for it.

Variable

Statistics

Tap a term, then the example it goes with.

Part 3: Cross-Tabulation

Descriptive analysis of single variables does not reveal how variables are related to one another.

Cross-tabulation describes two or more variables simultaneously.

It is the most widely used method of analysis in commercial marketing research.

Constructing a Cross-Tabulation

A cross-tabulation is a table that shows the joint distribution of two or more variables with a limited number of categories.

Each cell reports the number and percentage of respondents who share a particular combination of categories.

For example, a cross-tabulation of age group by preferred shopping channel reports, for each age group, the percentage who prefer online, in-store, or mobile shopping.

Cross-tabulation of 600 respondents by age group and preferred shopping channel, with percentages calculated within each age group. 18–34: online 30%, in-store 15%, mobile 55%; 35–54: online 36%, in-store 32%, mobile 32%; 55+: online 30%, in-store 60%, mobile 10%ONLINEIN-STOREMOBILETOTAL18–3430%N 6015%N 3055%N 110100%35–5436%N 9032%N 8032%N 80100%55+30%N 4560%N 9010%N 15100%TOTAL195200205600
Percentages within

Percentages are calculated in the direction of the variable considered to be the influencing variable, so that the categories of the other variable can be compared across its groups.

In the example, percentages are calculated within each age group, since age may influence channel preference, but channel preference cannot influence age.

Interpreting Cross-Tabulations

A difference in percentages across groups indicates an association between the two variables.

An association does not establish causation, as introduced in the discussion of descriptive research in Week 2.

The introduction of a third variable can reveal that an apparent association is spurious. For example, users of a retailer's mobile application may spend more than other customers because they tend to have higher incomes, not because they use the application.

Fifty percent of twenty app users are high spenders, against thirty percent of twenty other customersAPP USERS50%HIGH SPENDERSOTHER CUSTOMERS30%HIGH SPENDERS
Third variable

The introduction of a third variable can also reveal an association that was concealed in the original table, or show that the association holds only for some groups.

Whether a difference in a cross-tabulation is statistically significant is assessed with the chi-square test, introduced in Week 7.

Knowledge Check

A cross-tabulation shows that 62 percent of customers who attended a store's cooking class bought premium cookware, against 21 percent of customers who did not attend. When the table is split by whether the customer already owned premium cookware before the class, the difference largely disappears within each group. What does the analysis indicate?

Part 4: Data Visualization for Decision Makers

Findings are communicated to decision makers largely through charts and tables.

A chart is designed to communicate a specific finding, not to display all available data.

The design of a chart determines whether the finding is understood correctly.

Principles of Data Visualization

  1. Each chart communicates one principal finding, which is stated in its title.

  2. The chart type is selected according to the relationship the finding concerns.

  3. Data are labeled directly, rather than through a separate legend, wherever possible.

  4. Elements that do not represent data, such as three-dimensional effects, heavy gridlines, and decorative images, are removed.

  5. The value axis of a bar chart begins at zero, since the length of each bar represents its value.

  6. Color is used to distinguish categories or to highlight the principal finding, and is applied consistently across charts.

The same data charted twice. Above, to avoid: a generic title, three-dimensional bars in four colours identified by a legend, heavy gridlines, and a value axis from 50 to 75 percent. Below, to follow: a title stating the finding that the North has the most satisfied customers, horizontal bars from zero labelled directly with 72, 58, 55 and 51 percent, and colour only on the NorthCustomer Satisfaction by Region505560657075NorthEastSouthWestThe North has the most satisfied customersNorth72%East58%South55%West51%

Selecting a Chart

  1. A bar chart compares values across categories, such as market share by brand.

    A bar chart of market share for brands A to D: 34, 27, 21 and 18 percent34%A27%B21%C18%D
  2. A line chart shows change over time, such as monthly sales across two years.

    A line chart of monthly sales across 2024 and 2025, rising with a peak each December20242025
  3. A histogram shows the distribution of a single quantitative variable, such as the number of visits per customer.

    A histogram of the number of visits per customer, most customers at one to three visits and a tail to the right048
  4. A scatter plot shows the relationship between two quantitative variables, such as advertising expenditure and sales across regions.

    A scatter plot of advertising expenditure against sales for twelve regions, rising togetherADVERTISINGSALES
  5. A stacked bar chart showing percentages compares the composition of several groups, such as the channel mix of each age group.

    A stacked bar chart of the channel mix of three age groups, each bar summing to 100 percent18–3435–54ONLINEIN-STOREMOBILE55+100%
  6. A table is preferable to a chart when decision makers require exact values.

    A table of exact satisfaction scores for four regions in two years20242025North4.214.34East4.084.02South3.974.11West3.863.92
Exercise · Which one is it?

Each case states a finding for a presentation. Name the display that suits it.

Subscriptions to a meal-kit service rose every month from January 2024 to December 2025.

Which concept does this case show?

Misleading Visualizations

A truncated value axis exaggerates small differences, as when a bar chart of satisfaction scores begins at 3.8 rather than zero.

Satisfaction scores of 3.9, 4.0 and 4.3 for stores A, B and C, charted with a value axis from 0 to 4.5. Bar C is 1.1 times as long as bar A, while its score is 1.1 times as high01234512344.503.9A4.0B4.3CBAR C ÷ BAR A×1.1SCORE C ÷ SCORE A×1.1

A chart with two value axes can suggest a relationship that depends only on the scaling of the axes.

Twelve months of advertising spending, rising from 20 to 24.2 thousand dollars on the left axis, and website visits, rising from 50.1 to 51.2 thousand on a right axis from 0 to 100 thousand. The visits line is flatAD SPENDING, $KVISITS, THOUSANDS162024050100JANDEC
Right axis
  1. A selective time period can show a trend that does not hold over a longer period.

  2. Area and three-dimensional charts distort the perception of relative size.

  3. Misleading visualizations can result from inattention as well as from intent, and the researcher is responsible for either.

Discussion: One Dataset, Two Charts

Discussion: Two analysts receive the same dataset on customer satisfaction across four regions. One presents a bar chart with an axis from zero to five, and the other presents a bar chart with an axis from 3.5 to 4.5. What would a regional manager conclude from each chart, and which design communicates the data accurately?

The same satisfaction scores for four regions, North 4.2, East 4.0, South 3.9 and West 4.1, charted twice: on an axis from zero to five the bars look nearly equal; on an axis from 3.5 to 4.5 North's bar looks almost twice as long as South's012345NorthEastSouthWest3.53.7544.254.5NorthEastSouthWest

Part 5: AI Data-Analysis Assistants

AI data-analysis assistants allow analysts to ask questions of a dataset in natural language.

They are now widely used for data preparation, descriptive analysis, and visualization.

The standards of data preparation and analysis introduced in this week apply to their output in the same way as to analyses performed by researchers.

How AI Data-Analysis Assistants Work

The analyst uploads a dataset and asks a question, such as “What is the average satisfaction rating by region?”

Many assistants generate analysis code, execute it on the dataset, and report the result together with the code.

Some assistants generate answers from the text of the question and the data without executing code. Their numerical answers are not the result of a calculation and are particularly prone to error.

AI assistants can be used to produce frequency tables, descriptive statistics, cross-tabulations, and charts, and to explain statistical output.

Datasets containing personal or confidential data are uploaded only when the consent of respondents, the firm's data policies, and the terms of the tool permit it.

Sources of Error in AI-Assisted Analysis

  1. The coding of a variable may be misread, so that the code 99, which denotes a missing value, is treated as a valid response.

  2. Rows may be excluded without notice, so that a result is based on fewer respondents than the analyst assumes.

  3. A statistic may be applied that is inappropriate for the level of measurement, such as the mean of a nominal variable.

  4. The output may include figures that were not computed from the data, or describe an association in causal terms.

An AI assistant's answer to the question "What is the average satisfaction rating by region?" on a five-point scale. Without the codebook, the code 99 is counted as a rating: North 4.1, East 13.1, South 8.7, West 3.8. The assistant reports that East has the highest average satisfactionWhat is the average satisfaction rating by region?East has the highest average satisfaction, at 13.1.ABOVE THE SCALE MAXIMUM OF 5North4.1N 20East13.1N 20South8.7N 20West3.8N 20RESPONDENTS
Codebook

The output is presented fluently and with apparent confidence, whether or not it is correct.

Verifying AI-Assisted Analysis

  1. The analyst first supplies the codebook to the assistant, including the codes for missing values and the level of measurement of each variable.

  2. The analyst then reviews the code the assistant executed, including any filters and exclusions.

  3. The analyst then confirms the number of respondents on which each result is based.

  4. The analyst then reproduces the principal figures independently, using a different tool or method.

  5. The analyst then confirms that the interpretation is consistent with the level of measurement and the research design, and makes no causal claim that the design does not support.

  6. Finally, the analyst documents the questions asked and the code executed, so that the analysis can be reproduced.

Exercise · Put it in order

An analyst asks an AI assistant for average satisfaction by store. Put the verification steps in order.

Tap a step, then the number where it belongs.

Describing Model Responses

The responses of an AI model to repeated prompts are described with the same statistics as survey data: frequency distributions, measures of central tendency, and measures of dispersion.

The coefficient of variation, the standard deviation divided by the mean, compares the variability of responses across models and products measured on different scales.

A mean response alone can conceal important differences. Two models with the same mean on a Likert item may differ in whether their responses concentrate on one point or spread across the scale.

For ordinal responses, a consensus measure summarizes how concentrated the distribution is, from complete agreement on one scale point to an even split between the two extremes (Wadi, Ghodrat, & Philp, 2026).

Entropy, a common measure of uncertainty in AI research, treats the scale points as unordered categories, and therefore does not distinguish a split between adjacent points from a split between opposite extremes.

Responses of two models to the same seven-point item. Model A splits its responses equally between 4 and 5; model B splits them equally between 1 and 7. Entropy is 1.00 bits for both, while consensus is 0.87 for model A and 0.00 for model BMODEL A1234567CONSENSUS0.87ENTROPY 1.00 BITSMODEL B1234567CONSENSUS0.00ENTROPY 1.00 BITS

Charts of full response distributions for each model, rather than a single bar for each mean, show both the level and the variability of model behavior.

Knowledge Check

Two AI models each rate a new product 500 times on a seven-point purchase-intention item. Half of model X's responses are 3 and half are 4; half of model Y's responses are 1 and half are 6. A report concludes that the two models hold the same view, because both have a mean of 3.5 and both have an entropy of 1 bit. Which statement is correct?

Discussion: An Answer in Seconds

Discussion: A brand manager uploads a survey dataset to an AI assistant and asks which customer segment is most satisfied. The assistant replies within seconds with a segment name, a mean score, and a chart. Which checks should the brand manager perform before presenting the result to senior management?

Key Takeaways

  1. Data preparation consists of checking, coding, cleaning, treating missing values, and weighting, and every step is documented.

  2. The treatment of missing values affects the results, and the method selected is reported.

  3. Descriptive statistics are selected according to the level of measurement and the shape of the distribution.

  4. Cross-tabulation reveals associations between variables, which may be spurious and do not establish causation.

  5. Charts communicate one finding each, with a chart type suited to that finding and axes that represent the data accurately.

  6. AI data-analysis assistants accelerate analysis, but their code, case counts, and interpretations must be verified before the results inform a decision.

  7. The responses of AI models are described by their full distributions, including dispersion and, for ordinal scales, consensus, rather than by a single typical answer.