aNet.ai
Data Science/Lab work
0day streak0XP · Lv 1
← Lab 2 overview and setup
Lab 2 · Section 2 of 8

Calculate eight scores by hand

2A–2C

First · connect to the lecture

The mean and SD formulas in the lecture are applied to your eight generated scores. The code checks your working after you try it.

Week 2: centre and spread, PDF pp. 10–30

Your task

Find sum, mean, median, deviations, squared-deviation sum, sample variance and sample SD before revealing the check.

Evidence to include

Show the working and units. Compare sample and population-style SD and explain their divisors.

Notebook questions and code

Read here; run in your downloaded notebook. Start with its setup cells and run in order. Use your own ID and outputs where requested.

Download Lab 2 notebook

2 · Eight numbers, by hand first (15 min)

Run the next cell to obtain your eight numbers. Before running the checking cell, calculate their mean, median, sample variance and sample SD using a calculator if useful. Show intermediate steps; no Python writing is required.

Mean = sum / n. Deviations = value − mean. Sample variance = sum of squared deviations / (n−1). Sample SD = square root of sample variance.

Python · cell 7 — read here, run in your notebook
print('Your eight scores:',small.tolist())

Your reasoning

2A. Record: sum, n, mean, middle two scores, median, eight deviations, sum of squared deviations, sample variance, and sample SD. Include units.

2B. Prediction: if these eight scores were the entire population of interest, would the population SD be larger or smaller? Why?

Answer: Replace this text with your explanation.

Python · cell 9 — read here, run in your notebook
# CHECK ONLY AFTER YOUR HAND CALCULATIONS
s = pd.Series(small)
display(pd.DataFrame({'score':small,'deviation':small-small.mean(),
                     'squared deviation':(small-small.mean())**2}))
display(pd.Series({'mean':s.mean(),'median':s.median(),
    'sample variance':s.var(ddof=1),'pandas sample SD':s.std(),
    'NumPy population SD':np.std(small), 'NumPy sample SD':np.std(small,ddof=1)}))

Your reasoning

2C. Compare your work with the output. Correct any error and explain its source. Why do the two default SD results differ? State which divisor answers each question; explain why variance has points² but SD has points.

Answer: Replace this text with your explanation.

Saved only in this browser. This note doesn’t fill in the downloaded notebook; “reviewed” is a personal checklist, not a grade.

aNet.ai · Data Science Fundamentals · Weeks 1–5 · practice material, not an official examProgress saved in this browser