0% found this document useful (0 votes)
3 views7 pages

Simple Random Sampling

The document outlines a practical exercise in Simple Random Sampling (SRS) involving the marks of students. It details the sampling plan, calculations for sample mean, variance, standard deviation, and the construction of a 95% confidence interval for the population mean. Additionally, it includes R code for conducting the sampling and analysis, along with further questions for additional sampling scenarios.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views7 pages

Simple Random Sampling

The document outlines a practical exercise in Simple Random Sampling (SRS) involving the marks of students. It details the sampling plan, calculations for sample mean, variance, standard deviation, and the construction of a 95% confidence interval for the population mean. Additionally, it includes R code for conducting the sampling and analysis, along with further questions for additional sampling scenarios.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Hafiz Mohammad Afzaal

SAMPLING 1 PRACTICAL

Practical
Simple Random Sampling
1. Population (N = 45)
We have marks (out of 100) for 45 students. Assign each student an ID 1...45.
ID: Marks

ID Marks ID Marks ID Marks


1 58 16 66 31 89
2 72 17 88 32 57
3 81 18 73 33 62
4 69 19 59 34 78
5 77 20 76 35 86
6 84 21 82 36 56
7 63 22 65 37 91
8 90 23 71 38 69
9 55 24 60 39 72
10 68 25 85 40 68
11 74 26 54 41 73
12 79 27 67 42 59
13 61 28 80 43 87
14 83 29 75 44 66
15 70 30 64 45 70

Sampling plan
Method: Simple Random Sampling (SRS) without replacement.

Sample size: 𝑛 = 12

Chosen sample IDs (example reproducible selection)


3, 15, 18, 19, 22, 24, 25, 29, 35, 37, 43, 44
Corresponding sample marks
81, 70, 73, 59, 65, 60, 85, 75, 86, 91, 87, 66
Hafiz Mohammad Afzaal
SAMPLING 1 PRACTICAL

Step-by-step calculations
Step 1
Sum and sample mean
Compute the sum of the sample values:

Sum =81 + 70 + 73 + 59 + 65 + 60 + 85 + 75 + 86 + 91 + 87 + 66 = 898

Sample size 𝑛 = 12
Sample mean
∑ 𝑥̄ 898
𝑥̄ = = = 74.833333 … ≈ 74.8333
𝑛 12
Step 2
Deviations from mean and squared deviations

For each sample value 𝑥̄𝑖 compute deviation 𝑑𝑖 =𝑥̄𝑖 − 𝑥̄ 𝑎𝑛𝑑 𝑠𝑞𝑢𝑎𝑟𝑒𝑑 𝑑𝑒𝑣𝑖𝑎𝑡𝑖𝑜𝑛 𝑑𝑖2

𝒙𝒊 𝒅𝒊 =𝒙𝒊 − 𝒙 𝒅𝟐𝒊 (rounded)

81 (81 - 74.8333 = 6.1666667) 38.02778

70 -4.8333333 23.36111

73 -1.8333333 3.36111

59 -15.8333333 250.69444

65 -9.8333333 96.69444

60 -14.8333333 220.02778

85 10.1666667 103.36111

75 0.1666667 0.02778

86 11.1666667 124.69444

91 16.1666667 261.36111

87 12.1666667 148.02778

66 -8.8333333 78.02778
Hafiz Mohammad Afzaal
SAMPLING 1 PRACTICAL

Now sum the squared deviations:


12

∑ 𝑑𝑖2 = 1347.66666777(𝑟𝑜𝑢𝑛𝑑𝑒𝑑)
𝑖=1

Step 3
Sample variance and sample standard deviation

Sample variance (unbiased estimator) uses 𝑛 − 1in the denominator

2 ∑ 𝑑𝑖2 1347.6666667
𝑠 = = = 122.1515151 …
𝑛−1 11

Sample standard deviation:

𝑠 = √𝑠 2 = √122.515151 ≈ 11.0686563

Step 4
Standard error of the mean (SE)
𝑠 11.0686563 11.0686563
𝑆𝐸 = = = ≈ 3.1952458
√𝑛 12 3.4641016

Step 5
95% t-confidence interval for the population mean

With small sample size we use the t-distribution. Degrees of freedom 𝑑𝑓 = 𝑛 − 1 = 11

From t-tables (two-sided 95%): 𝑡0.975,11 ≈ 2.20099

Compute margin of error:

𝑀𝐸 = 𝑡0.975,11 × 𝑆𝐸 ≈ 2.20099 × 3.1952458 ≈ 7.032689

Thus the 95% CI for the population mean is:

𝑥̄̅ ± 𝑀𝐸 = 74.8333 ± 7.0327

𝐶𝐼 ≈ (67.8006,81.8660)

Round as appropriate for presentation, e.g. (67.80, 81.87)


Hafiz Mohammad Afzaal
SAMPLING 1 PRACTICAL

Interpretation
From this SRS of 12 students, we estimate the average mark in the population to be about 74.83.
With 95% confidence, the true population mean lies roughly between 67.80 and 81.87. Note the
interval width with a small sample the CI is fairly wide; increasing 𝑛 would narrow it.

R Code SRS with 45 Observations


Hafiz Mohammad Afzaal
SAMPLING 1 PRACTICAL

Explanation of Code
1. marks — defines the population of 45 student marks.
2. 𝑛 < − 12 — sample size.
3. set. Seed (123) — ensures reproducible random selection.
4. Sample (marks, n) — draws 12 random students from population.
5. Mean () and Sd () — compute sample mean and standard deviation.
6. SE — standard error of the mean.
7. qt (0.975, d f = n-1) — t-critical value for 95% confidence interval.
8. 𝐶𝐼_95 — final 95% t-confidence interval for population mean.
Hafiz Mohammad Afzaal
SAMPLING 1 PRACTICAL

Question 2
A simple random sample of 10 students was selected from a population of 40 students’ marks using
the random sampling method. Each student had an equal chance of selection. Using Simple
Random Sampling (SRS) without replacement, Compute the sample mean and sample standard
deviation of the selected marks. Calculate the standard error of the mean (SE). Construct a 95%
confidence interval for the population mean using the t-distribution. Interpret the obtained
confidence interval in the context of the population. And also write a program
Population (N = 40)
Marks of 40 students:

ID Marks ID Marks ID Marks


1 72 16 78 31 86
2 65 17 66 32 57
3 80 18 73 33 69
4 68 19 70 34 72
5 77 20 79 35 74
6 84 21 64 36 65
7 59 22 88 37 87
8 71 23 60 38 71
9 63 24 76 39 78
10 82 25 81 40 80
11 55 26 67
12 69 27 62
13 74 28 83
14 61 29 75
15 85 30 68
Hafiz Mohammad Afzaal
SAMPLING 1 PRACTICAL

Question 3
Using the marks of 50 students given in the population, select a simple random sample (SRS) of
12 students without replacement. Compute the sample mean and sample standard deviation of the
selected marks. Calculate the standard error (SE) of the sample mean. Construct a 95% confidence
interval for the population mean using the t-distribution. Interpret the confidence interval in the
context of the population of 50 students.

ID Marks ID Marks ID Marks ID Marks ID Marks


1 58 11 62 21 55 31 85 41 71
2 69 12 79 22 73 32 59 42 80
3 72 13 85 23 60 33 88 43 66
4 65 14 74 24 70 34 65 44 72
5 80 15 90 25 68 35 69 45 76
6 77 16 88 26 76 36 75 46 69
7 68 17 66 27 81 37 78 47 74
8 74 18 75 28 67 38 82 48 83
9 71 19 79 29 72 39 90 49 88
10 83 20 84 30 63 40 87 50 70

You might also like