Data Analysis

What are the basic steps of a data analysis project?

A basic analysis follows a clear sequence, from the question to the conclusion. Having the steps in order helps you avoid wasted work and unclear results.

The steps: 1) Define the question and what a useful answer looks like. 2) Collect the data you need from reliable sources. 3) Clean the data. 4) Explore it with summaries and simple charts. 5) Analyse it with the method that fits the question. 6) Check your result for errors and for other explanations. 7) Present your findings clearly, with the limits of the data.

You will often go back and repeat earlier steps, for example when exploring shows a data problem. That is normal.

What question would you like to answer with data?

What is the difference between correlation and causation?

Correlation means two things change together. Causation means that a change in one thing produces a change in the other. A correlation alone does not show that one causes the other.

Why they get confused: 1) A third factor can drive both. Ice cream sales and sunburn both rise in summer because of hot weather, not because one causes the other. 2) The direction can be unclear: does A affect B, or B affect A? 3) The pattern can occur by chance, especially in small samples.

To support a causal claim, analysts use controlled experiments, careful study design and methods that account for other factors. Be careful with words such as “causes” when your data only shows a link.

Can you think of two things that rise together but do not cause each other?

How do I choose the right chart for my data?

The best chart depends on the question you want to answer. Start with the question, then choose the chart that shows that kind of comparison most clearly.

A simple guide: 1) Comparing categories: a bar chart. 2) Changes over time: a line chart. 3) Relationship between two numbers: a scatter plot. 4) Distribution of one number: a histogram. 5) Parts of a whole with few categories: a bar chart or a simple pie chart. 6) Exact values: a table.

Keep the chart simple: label the axes, include units, start bar charts at zero, and avoid decoration and too many colours that do not carry meaning.

Which chart would you use to show monthly sales for a year?

How do I clean messy data before analysing it?

Data cleaning means fixing or removing problems in a dataset so that your results are reliable. Real data often has missing values, duplicates, inconsistent formats and obvious entry errors.

A basic routine: 1) Keep a copy of the original data and work on a copy. 2) Look at the data first: column names, types, ranges and a few rows. 3) Remove exact duplicates. 4) Handle missing values deliberately: fill, estimate or remove them, and note what you chose. 5) Make formats consistent, such as dates, units and spelling of categories. 6) Check for impossible values, for example an age of 250.

Write down every change you make. This lets someone repeat your work and helps you explain your results.

What is the messiest dataset you have seen?

What is the difference between the mean, median and mode?

The mean, median and mode are three ways to describe the centre of a set of numbers. The mean is the sum divided by the count. The median is the middle value when the numbers are sorted. The mode is the value that appears most often.

Example with 2, 3, 3, 4, 18: 1) Mean: (2 + 3 + 3 + 4 + 18) divided by 5 gives 6. 2) Median: the middle value of the sorted list is 3. 3) Mode: 3 appears twice, so the mode is 3. The large value 18 pulls the mean up but does not change the median.

Use the median when the data has extreme values, such as incomes or house prices. Use the mean when the values are fairly balanced. The mode is useful for categories, such as the most common shoe size.

Which of the three would you use to describe the salaries in your town, and why?

Category