Assignment Help Center
Services
Editing
Samples
Free AI Tools
About Us
Order Now WhatsApp

Statistical Analysis: Hypothesis Testing and Linear Regression on a Dataset

Sample overview
Subject: Statistics · Type: Assignment · Level: Undergraduate · ~1828 words · Harvard referencing
Written by an AHC subject expert in Statistics, to a first-class / distinction standard. This is an original sample provided for reference and learning — please do not submit it as your own work.

Written by an AHC subject expert in Statistics.

> Note: This is a published student-facing sample produced by Assignment Help Center to illustrate how a first-class undergraduate statistics assignment is structured and argued. Both datasets used below are illustrative and were created for teaching purposes; they do not represent real participants. Every quantity reported has been independently recomputed in Python (NumPy and SciPy) and by hand from first principles.

1. Introduction

Applied statistics rests on two complementary questions. First, is a difference we observe between groups large enough to be taken seriously, or could it plausibly be an artefact of sampling? Second, when two continuous variables move together, can we describe and quantify that relationship well enough to make predictions? This assignment answers both. Part A uses an independent-samples t-test to compare examination performance under two teaching methods. Part B fits a simple linear regression relating weekly independent-study hours to final examination scores. Throughout, the emphasis is not merely on producing a p-value but on checking assumptions, reporting effect sizes, and interpreting results in plain language, which is the standard expected of rigorous quantitative work (Field, 2018).

A recurring theme in modern statistical teaching is that a hypothesis test answers a narrow question — how surprising the data would be if the null hypothesis were true — and nothing more. It does not, on its own, tell us whether a difference matters in practice, nor whether the study was designed well enough to support a causal claim. For that reason each part of this assignment pairs its significance test with a measure of magnitude: Cohen’s d and a confidence interval in Part A, and the coefficient of determination together with a residual analysis in Part B. This structure mirrors the reporting conventions now recommended across the discipline (Agresti and Franklin, 2014; Moore, McCabe and Craig, 2017). All computation was carried out in Python using the NumPy and SciPy libraries, and every hand-calculated figure was cross-checked against the corresponding library function to guard against arithmetic slips.

2. Part A: Descriptive Statistics and Hypothesis Testing

2.1 The dataset

An illustrative sample of 24 students was split into two groups of twelve. Group A was taught using traditional lectures; Group B experienced a “flipped classroom”. The outcome is the end-of-term examination score (per cent). The raw data are shown in Table 1.

Table 1. Illustrative examination scores (%) by teaching method

Scores
Group A (traditional)58, 62, 65, 61, 70, 55, 68, 60, 63, 59, 66, 57
Group B (flipped)72, 75, 69, 78, 74, 71, 80, 68, 76, 73, 77, 70

2.2 Descriptive summary

The sample mean for each group is calculated as the sum of scores divided by the count. For Group A the scores sum to 744, giving a mean of 744 ÷ 12 = 62.00; for Group B the scores sum to 883, giving 883 ÷ 12 = 73.58. The sample standard deviation uses the Bessel-corrected (n − 1) denominator. Table 2 gathers the key descriptives.

Table 2. Descriptive statistics by group

StatisticGroup AGroup B
n1212
Mean62.0073.58
Median61.573.5
Standard deviation (s)4.5733.753
Variance (s²)20.90914.083
Q1 – Q358.75 – 65.2570.75 – 76.25
IQR6.55.5
Minimum – Maximum55 – 7068 – 80

The flipped-classroom group scored roughly 11.6 percentage points higher on average, and its scores are also slightly less dispersed, as the smaller standard deviation and narrower interquartile range both show. The medians sit close to the means in both groups, hinting at broadly symmetric distributions rather than heavy skew, and there is no evidence of extreme outliers that might distort a mean-based comparison. These observations matter because the validity of the t-test depends on such distributional features, so it is good practice to inspect them before formal testing rather than after.

2.3 Hypotheses

Because we are comparing the means of two independent groups, the appropriate test is the independent-samples t-test (Agresti and Franklin, 2014). The hypotheses are stated for the population means μ_A and μ_B:

  • Null hypothesis (H₀): μ_A = μ_B (teaching method makes no difference to mean score).
  • Alternative hypothesis (H₁): μ_A ≠ μ_B (a two-tailed test, since we did not pre-specify a direction).

The significance level is set at α = 0.05.

2.4 Checking assumptions

The t-test assumes that observations are independent, that each group is approximately normally distributed, and — for the pooled-variance (“Student”) version — that the two population variances are equal. Independence follows from the study design. Normality was assessed with the Shapiro–Wilk test, which returned p = 0.980 for Group A and p = 0.972 for Group B; neither is significant, so the normality assumption is tenable. Equality of variances was checked with Levene’s test, which gave a statistic of 0.399 and p = 0.534, comfortably non-significant. The pooled-variance t-test is therefore justified, though a Welch correction would give an almost identical result here.

2.5 Test statistic (worked by hand)

The pooled standard deviation combines the two sample variances, weighted by their degrees of freedom:

$$s_p = \sqrt{\frac{(n_A-1)s_A^2 + (n_B-1)s_B^2}{n_A + n_B – 2}} = \sqrt{\frac{11(20.909) + 11(14.083)}{22}} = \sqrt{17.496} = 4.183$$

The standard error of the difference between means is:

$$SE = s_p\sqrt{\frac{1}{n_A}+\frac{1}{n_B}} = 4.183\sqrt{\frac{1}{12}+\frac{1}{12}} = 4.183 \times 0.4082 = 1.708$$

The t-statistic is the observed mean difference divided by this standard error:

$$t = \frac{\bar{x}_A – \bar{x}_B}{SE} = \frac{62.00 – 73.58}{1.708} = -6.783$$

with df = n_A + n_B − 2 = 22. The two-tailed critical value at α = 0.05 is t₀.₉₇₅,₂₂ = ±2.074. Because |−6.783| = 6.783 far exceeds 2.074, we reject H₀. The exact p-value computed in SciPy is p ≈ 8.14 × 10⁻⁷, or about 0.0000008.

2.6 Effect size and confidence interval

Statistical significance alone does not convey how large the difference is, so an effect size is reported (Field, 2018). Cohen’s d divides the mean difference by the pooled standard deviation:

$$d = \frac{73.58 – 62.00}{4.183} = 2.77$$

By Cohen’s conventional benchmarks a d of 0.8 is “large”, so a value of 2.77 indicates a very substantial difference. The 95% confidence interval for the difference in means (B − A) is:

$$11.583 \pm 2.074 \times 1.708 = 11.583 \pm 3.542 = (8.04,\ 15.12)$$

Because this interval lies wholly above zero, it reinforces the conclusion that the flipped classroom is associated with genuinely higher scores in this illustrative sample.

2.7 Interpretation

There is very strong evidence (t(22) = −6.78, p < 0.001, d = 2.77) that mean examination performance differs between the two teaching methods, with the flipped classroom scoring on average 11.6 points higher (95% CI: 8.0 to 15.1). In practical terms, that is the difference between a mid-range and an upper-range grade band. The extremely small p-value means that, if the two methods really produced identical mean scores, a difference as large as the one observed would arise by chance fewer than one time in a million samples of this size — a strong signal, though the modest sample of twelve per group should temper any sweeping generalisation. It should be stressed that these are observational, illustrative data: the analysis establishes a difference, not that the teaching method caused it, since factors such as prior ability, motivation and attendance were not controlled. A well-designed follow-up would randomise students to conditions and pre-register the analysis, which would strengthen any causal reading considerably.

3. Part B: Simple Linear Regression

3.1 The dataset

A second illustrative sample of 15 students recorded weekly hours of independent study (x) against final examination score in per cent (y). The aim is to model y as a linear function of x and to test whether the relationship is statistically significant.

Table 3. Illustrative study hours and examination scores

Student123456789101112131415
Hours (x)23568910124711131146
Score (y)545166607168798057637483498569

3.2 Model and estimation

The model is ŷ = b₀ + b₁x, fitted by ordinary least squares, which chooses the slope and intercept that minimise the sum of squared residuals. The slope and intercept are obtained from the sums of squares about the means. With x̄ = 7.40 and ȳ = 67.27, the corrected sums of squares are:

  • S_xx = Σ(x − x̄)² = 229.60
  • S_yy = Σ(y − ȳ)² = 1876.93
  • S_xy = Σ(x − x̄)(y − ȳ) = 629.40

The slope is:

$$b_1 = \frac{S_{xy}}{S_{xx}} = \frac{629.40}{229.60} = 2.741$$

and the intercept is:

$$b_0 = \bar{y} – b_1\bar{x} = 67.27 – 2.741 \times 7.40 = 46.98$$

The fitted regression equation is therefore:

$$\hat{y} = 46.98 + 2.741x$$

Each additional hour of weekly independent study is associated with a predicted increase of about 2.74 percentage points in the examination score. The intercept of 46.98 is the model’s prediction for a student who studies zero hours; it is within the range of the data and so is interpretable here, though extrapolation well beyond the observed span of 1–14 hours would not be safe.

3.3 Strength of the relationship

The Pearson correlation coefficient is:

$$r = \frac{S_{xy}}{\sqrt{S_{xx}\,S_{yy}}} = \frac{629.40}{\sqrt{229.60 \times 1876.93}} = 0.9588$$

The coefficient of determination is r² = 0.9192. In other words, about 91.9% of the variation in examination scores is explained by the linear relationship with study hours, leaving roughly 8% attributable to other factors and random variation. This partition can be seen directly in the sums of squares: the total sum of squares SST = 1876.93 splits into an explained (regression) sum of squares SSR = 1725.37 and a residual sum of squares SSE = 151.57, and 1725.37 ÷ 1876.93 = 0.919, confirming r² independently.

3.4 Significance of the slope

To test whether the true slope differs from zero we use H₀: β₁ = 0 against H₁: β₁ ≠ 0. The standard error of the slope is 0.2253, giving:

$$t = \frac{b_1}{SE(b_1)} = \frac{2.741}{0.2253} = 12.17$$

on df = n − 2 = 13. The critical value t₀.₉₇₅,₁₃ = ±2.160 is greatly exceeded, and SciPy returns p ≈ 1.77 × 10⁻⁸. We therefore reject the null hypothesis and conclude that study hours are a significant linear predictor of examination score. The 95% confidence interval for the slope is 2.741 ± 2.160 × 0.2253 = (2.25, 3.23), which excludes zero and is reassuringly narrow.

3.5 Prediction and residual check

Substituting into the fitted equation gives point predictions:

  • For x = 5 hours: ŷ = 46.98 + 2.741 × 5 = 60.69%
  • For x = 10 hours: ŷ = 46.98 + 2.741 × 10 = 74.39%

The residual standard error — the typical size of a prediction error — is √(SSE ÷ 13) = √11.66 = 3.41 percentage points, so predictions are generally accurate to within a few marks. Inspecting the residuals (for example −4.21 for the second student and +5.57 for the fifteenth) shows no obvious pattern, curvature, or fanning-out as x increases, which supports the assumptions of linearity and constant variance that underpin the model (Wooldridge, 2019).

3.6 Interpretation

The regression provides strong evidence of a positive linear association between independent study and attainment (r = 0.96, r² = 0.92, t(13) = 12.17, p < 0.001). Every extra hour of weekly study predicts roughly 2.7 additional marks. As always, association is not causation: motivated students may both study more and perform better for reasons the model does not capture, and the illustrative nature of the data means these figures are for demonstration rather than inference about any real cohort.

3.7 Limitations of the model

Two limitations deserve explicit mention. First, a simple linear model assumes the effect of study is constant across the whole range; in reality one would expect diminishing returns as hours rise and scores approach the 100% ceiling, so a curved (for example logarithmic or quadratic) specification might fit an extended dataset better. Second, with only fifteen observations the estimates, though precise here, rest on a small sample, and a single unusual student could exert noticeable leverage on the slope. In a full study one would examine influence diagnostics such as Cook’s distance and consider adding control variables — prior attainment, contact hours, or attendance — in a multiple-regression framework (Wooldridge, 2019). These extensions would move the analysis from description toward a more defensible explanatory model.

4. Conclusion

This assignment applied two core inferential techniques to illustrative data. The independent-samples t-test found a large, highly significant difference in examination scores between two teaching methods, supported by a Cohen’s d of 2.77 and a confidence interval well clear of zero. The simple linear regression showed that weekly study hours explain around 92% of the variation in examination scores, with a significant positive slope of 2.74 marks per hour. In both parts the workflow was the same and is what distinguishes competent from careless analysis: state hypotheses, check assumptions, compute the statistic by hand and verify it computationally, quantify the effect, and interpret the result honestly with its limitations. Sound statistical practice is as much about disciplined reporting as it is about arithmetic (Field, 2018; Moore, McCabe and Craig, 2017).

References

Agresti, A. and Franklin, C. (2014) Statistics: The Art and Science of Learning from Data. 3rd edn. Harlow: Pearson.

Field, A. (2018) Discovering Statistics Using IBM SPSS Statistics. 5th edn. London: Sage.

Moore, D.S., McCabe, G.P. and Craig, B.A. (2017) Introduction to the Practice of Statistics. 9th edn. New York: W.H. Freeman.

Navidi, W. (2020) Statistics for Engineers and Scientists. 5th edn. New York: McGraw-Hill.

Ott, R.L. and Longnecker, M. (2016) An Introduction to Statistical Methods and Data Analysis. 7th edn. Boston: Cengage Learning.

Wooldridge, J.M. (2019) Introductory Econometrics: A Modern Approach. 7th edn. Boston: Cengage Learning.

Need a custom assignment like this?

Get an original, expertly written Statistics assignment tailored to your brief — fully referenced and plagiarism-checked.

Get expert help →
admin - Assignment Help Center

admin

The Assignment Help Center editorial team comprises qualified academic writers and editors who collaborate to produce high-quality content, writing guides, and academic resources for students worldwide.

View all posts by admin
WhatsApp