Menu Close

Analysis of variance: UPSC Statistics Optional PYQ Solutions (1995–2024)

All 14 questions UPSC has asked on analysis of variance in the Statistics Optional (Paper I, Linear Inference and Multivariate Analysis) from 1995 to 2024, solved step by step – latest first.

Try them yourself first: the same questions, without solutions, are on our Linear Inference and Multivariate Analysis topic-wise PYQs page.

How we check these solutions

These are our own solutions, prepared with AI help. UPSC does not publish official answers. Every solution is checked a second way before it goes up, and says how:

  • ✓ Checked by computer the numbers were worked out again independently in code (Python with NumPy/SciPy) and matched.
  • ✓ Proof checked step by step for “prove that” and “examine whether” questions, every step was checked against the definitions and the standard theorems.
  • ✓ Derivation checked step by step for derivations and approximations, every step was checked, and the result was also tested numerically.
  • ✓ Answer checked step by step for descriptive questions, every point was checked against the standard theory.

Spotted a mistake or a neater method? Tell us in the comments below or through Report an error.

Jump to a question (year · question number):

2024 · 8c 2023 · 6b(i) 2022 · 6a 2017 · 8a 2012 · 6b 2006 · 8a 2005 · 5b 2003 · 6c 2001 · 6iii 1998 · 9c 1998 · 10a 1996 · 10c 1995 · 9a 1995 · 9b

Cover of the UPSC Prelims Topic-wise PYQ book with detailed explanations

From the Optional Province team

Preparing for Prelims too?

Our UPSC Prelims Topic-wise PYQ Book covers every Prelims question with detailed explanations, so you can see exactly where UPSC asks from. Now available as a hard copy and an eBook.

Buy Hard Copy on AmazonBuy eBook (PDF)

Download a free sample

Write down the model used in the analysis of a two-way classification with interactions, stating the assumptions. What are the hypotheses tested in this scenario? Obtain the expression for the sum of squares and complete the ANOVA.

2024 · Paper I · Q8c · 15 marks

Solution

Model. Factor A has pp levels, factor B has qq levels, and each of the pqpq cells has rr observations (r≥2r\ge2, so that interaction can be separated from error): yijk=μ+αi+βj+(αβ)ij+eijk,i=1,…,p;j=1,…,q;k=1,…,r.y_{ijk}=\mu+\alpha_i+\beta_j+(\alpha\beta)_{ij}+e_{ijk},\qquad i=1,\dots,p;\ j=1,\dots,q;\ k=1,\dots,r .

  • μ\mu is the general mean, αi\alpha_i the effect of the ii-th level of A, βj\beta_j the effect of the jj-th level of B, and (αβ)ij(\alpha\beta)_{ij} the interaction of Ai_i and Bj_j.

Assumptions.

  1. The effects are fixed, with ∑iαi=0\sum_i\alpha_i=0, ∑jβj=0\sum_j\beta_j=0, ∑i(αβ)ij=0\sum_i(\alpha\beta)_{ij}=0 for every jj and ∑j(αβ)ij=0\sum_j(\alpha\beta)_{ij}=0 for every ii.
  2. The errors eijke_{ijk} are independent N(0,σ2)N(0,\sigma^2): normality, independence and a common variance.
  3. The effects are additive in the sense of the model above.

Hypotheses tested. H0A:α1=…=αp=0,H0B:β1=…=βq=0,H0AB:(αβ)ij=0for all i,j.H_{0A}:\alpha_1=\dots=\alpha_p=0,\qquad H_{0B}:\beta_1=\dots=\beta_q=0,\qquad H_{0AB}:(\alpha\beta)_{ij}=0\ \text{for all }i,j .

Least squares estimates. Minimising ∑∑∑(yijk−μ−αi−βj−(αβ)ij)2\sum\sum\sum(y_{ijk}-\mu-\alpha_i-\beta_j-(\alpha\beta)_{ij})^2 under the side conditions gives μ̂=y‾⋯,α̂i=y‾i⋅⋅−y‾⋯,β̂j=y‾⋅j⋅−y‾⋯,(αβ)̂ij=y‾ij⋅−y‾i⋅⋅−y‾⋅j⋅+y‾⋯.\hat\mu=\bar y_{\cdots},\quad\hat\alpha_i=\bar y_{i\cdot\cdot}-\bar y_{\cdots},\quad\hat\beta_j=\bar y_{\cdot j\cdot}-\bar y_{\cdots},\quad\widehat{(\alpha\beta)}_{ij}=\bar y_{ij\cdot}-\bar y_{i\cdot\cdot}-\bar y_{\cdot j\cdot}+\bar y_{\cdots}.

Splitting the total sum of squares. Write yijk−y‾⋯=(y‾i⋅⋅−y‾⋯)+(y‾⋅j⋅−y‾⋯)+(y‾ij⋅−y‾i⋅⋅−y‾⋅j⋅+y‾⋯)+(yijk−y‾ij⋅).y_{ijk}-\bar y_{\cdots}=(\bar y_{i\cdot\cdot}-\bar y_{\cdots})+(\bar y_{\cdot j\cdot}-\bar y_{\cdots})+(\bar y_{ij\cdot}-\bar y_{i\cdot\cdot}-\bar y_{\cdot j\cdot}+\bar y_{\cdots})+(y_{ijk}-\bar y_{ij\cdot}). Square and sum over i,j,ki,j,k. Every cross-product vanishes, because each bracket sums to zero over the index it does not share with the other. So ∑ijk(yijk−y‾⋯)2⏟ST=qr∑i(y‾i⋅⋅−y‾⋯)2⏟SA+pr∑j(y‾⋅j⋅−y‾⋯)2⏟SB+r∑ij(y‾ij⋅−y‾i⋅⋅−y‾⋅j⋅+y‾⋯)2⏟SAB+∑ijk(yijk−y‾ij⋅)2⏟SE.\underbrace{\sum_{ijk}(y_{ijk}-\bar y_{\cdots})^2}_{S_T}=\underbrace{qr\sum_i(\bar y_{i\cdot\cdot}-\bar y_{\cdots})^2}_{S_A}+\underbrace{pr\sum_j(\bar y_{\cdot j\cdot}-\bar y_{\cdots})^2}_{S_B}+\underbrace{r\sum_{ij}(\bar y_{ij\cdot}-\bar y_{i\cdot\cdot}-\bar y_{\cdot j\cdot}+\bar y_{\cdots})^2}_{S_{AB}}+\underbrace{\sum_{ijk}(y_{ijk}-\bar y_{ij\cdot})^2}_{S_E}.

For hand calculation, with GG the grand total, Ti⋅⋅T_{i\cdot\cdot}, T⋅j⋅T_{\cdot j\cdot}, Tij⋅T_{ij\cdot} the row, column and cell totals and CF=G2/pqr\text{CF}=G^2/pqr: ST=∑yijk2−CF,SA=∑iTi⋅⋅2qr−CF,SB=∑jT⋅j⋅2pr−CF,S_T=\sum y_{ijk}^2-\text{CF},\quad S_A=\frac{\sum_iT_{i\cdot\cdot}^2}{qr}-\text{CF},\quad S_B=\frac{\sum_jT_{\cdot j\cdot}^2}{pr}-\text{CF}, SAB=∑ijTij⋅2r−CF−SA−SB,SE=ST−SA−SB−SAB.S_{AB}=\frac{\sum_{ij}T_{ij\cdot}^2}{r}-\text{CF}-S_A-S_B,\qquad S_E=S_T-S_A-S_B-S_{AB}.

Expected mean squares. E(MA)=σ2+qr∑αi2p−1,E(MB)=σ2+pr∑βj2q−1,E(MAB)=σ2+r∑∑(αβ)ij2(p−1)(q−1),E(ME)=σ2.E(M_A)=\sigma^2+\frac{qr\sum\alpha_i^2}{p-1},\quad E(M_B)=\sigma^2+\frac{pr\sum\beta_j^2}{q-1},\quad E(M_{AB})=\sigma^2+\frac{r\sum\sum(\alpha\beta)_{ij}^2}{(p-1)(q-1)},\quad E(M_E)=\sigma^2 . Under each null hypothesis the corresponding mean square also estimates σ2\sigma^2, and by Cochran’s theorem the sums of squares are independent σ2χ2\sigma^2\chi^2 variables. So each ratio below has an FF distribution under its own H0H_0.

ANOVA table.

Source df SS MS F
Factor A p−1p-1 SAS_A MA=SA/(p−1)M_A=S_A/(p-1) MA/MEM_A/M_E
Factor B q−1q-1 SBS_B MB=SB/(q−1)M_B=S_B/(q-1) MB/MEM_B/M_E
Interaction AB (p−1)(q−1)(p-1)(q-1) SABS_{AB} MAB=SAB/(p−1)(q−1)M_{AB}=S_{AB}/(p-1)(q-1) MAB/MEM_{AB}/M_E
Error pq(r−1)pq(r-1) SES_E ME=SE/pq(r−1)M_E=S_E/pq(r-1)
Total pqr−1pqr-1 STS_T

Reject H0AH_{0A} at level α\alpha if MA/ME>Fα(p−1,pq(r−1))M_A/M_E>F_{\alpha}(p-1,\,pq(r-1)), and similarly for B and AB. We test the interaction first: if it is significant, the main effects should be interpreted cell by cell rather than averaged over the other factor.

✓ Derivation checked step by step Every step was checked: the least squares estimates under the usual side conditions, the orthogonal split of the total sum of squares, and the expected mean squares used for the F tests.

↑ Back to the question list

Describe the complete analysis of two-way classified data with multiple (but equal) observations per cell, clearly stating the assumptions used. Also state two examples where such type of analysis is used.

2023 · Paper I · Q6b(i) · 15 marks

Solution

Data and model. Two factors are applied together: A at pp levels and B at qq levels, with r>1r>1 (equal) observations in every cell. The model is yijk=μ+αi+βj+(αβ)ij+eijk,k=1,…,r.y_{ijk}=\mu+\alpha_i+\beta_j+(\alpha\beta)_{ij}+e_{ijk},\qquad k=1,\dots,r .

Assumptions.

  1. The observations are independent, and eijk∼N(0,σ2)e_{ijk}\sim N(0,\sigma^2) with the same σ2\sigma^2 in every cell.
  2. Fixed effects with ∑αi=∑βj=0\sum\alpha_i=\sum\beta_j=0 and the interactions summing to zero over each row and each column.
  3. Equal numbers rr per cell, so that the factors are orthogonal and the sums of squares split exactly.

Analysis.

  1. Compute the grand total GG, CF=G2/pqr\text{CF}=G^2/pqr, and the raw sum of squares ∑yijk2\sum y_{ijk}^2.
  2. Form the two-way table of cell totals Tij⋅T_{ij\cdot}, with row totals Ti⋅⋅T_{i\cdot\cdot} and column totals T⋅j⋅T_{\cdot j\cdot}.
  3. Compute ST=∑y2−CF,SA=1qr∑Ti⋅⋅2−CF,SB=1pr∑T⋅j⋅2−CF,S_T=\sum y^2-\text{CF},\quad S_A=\tfrac{1}{qr}\sum T_{i\cdot\cdot}^2-\text{CF},\quad S_B=\tfrac1{pr}\sum T_{\cdot j\cdot}^2-\text{CF}, Scells=1r∑Tij⋅2−CF,SAB=Scells−SA−SB,SE=ST−Scells.S_{\text{cells}}=\tfrac1r\sum T_{ij\cdot}^2-\text{CF},\quad S_{AB}=S_{\text{cells}}-S_A-S_B,\quad S_E=S_T-S_{\text{cells}}.
  4. Set up the table:
Source df SS MS F
A p−1p-1 SAS_A MAM_A MA/MEM_A/M_E
B q−1q-1 SBS_B MBM_B MB/MEM_B/M_E
AB (p−1)(q−1)(p-1)(q-1) SABS_{AB} MABM_{AB} MAB/MEM_{AB}/M_E
Error pq(r−1)pq(r-1) SES_E MEM_E
Total pqr−1pqr-1 STS_T
  1. Test the interaction first. If MAB/MEM_{AB}/M_E is not significant, test A and B against MEM_E; some workers pool SABS_{AB} with SES_E to get more error degrees of freedom. If the interaction is significant, compare the levels of one factor separately at each level of the other, using the cell means y‾ij⋅\bar y_{ij\cdot} with standard error 2ME/r\sqrt{2M_E/r}.
  2. Where a main effect is significant, compare level means with the critical difference tα/2,pq(r−1)2ME/(qr)t_{\alpha/2,\,pq(r-1)}\sqrt{2M_E/(qr)} for A (or 2ME/(pr)\sqrt{2M_E/(pr)} for B).

Two examples where this analysis is used.

  • Agriculture: yields of several wheat varieties (factor A) under several fertiliser doses (factor B), with rr plots per combination. The interaction tells us whether the best variety depends on the dose.
  • Industry: the strength of a product made on several machines (A) by several operators (B), with rr items per machine–operator pair. It tells us whether some operators do better on particular machines.

Other examples are teaching methods × schools in education, and drug × dose in clinical trials.

✓ Answer checked step by step Every step was checked: the model, the orthogonal split of the sum of squares, the degrees of freedom and the F ratios, as in the standard two-way analysis with replication.

↑ Back to the question list

In a set of two-way classified data according to k levels of factor A and r levels of factor B, there is one observation in each cell. Show that the total number of error contrasts is (r−1)(k−1).

2022 · Paper I · Q6a · 15 marks

Solution

Setting. The model is yij=μ+αi+βj+eijy_{ij}=\mu+\alpha_i+\beta_j+e_{ij} with i=1,…,ki=1,\dots,k (levels of A) and j=1,…,rj=1,\dots,r (levels of B), one observation per cell, so N=krN=kr observations.

An error contrast is a linear function ∑∑cijyij\sum\sum c_{ij}y_{ij} whose expectation is zero whatever the values of μ,αi,βj\mu,\alpha_i,\beta_j. We must count the linearly independent ones.

Condition. E(∑ijcijyij)=μ∑ijcij+∑iαi(∑jcij)+∑jβj(∑icij).E\Big(\sum_{ij}c_{ij}y_{ij}\Big)=\mu\sum_{ij}c_{ij}+\sum_i\alpha_i\Big(\sum_jc_{ij}\Big)+\sum_j\beta_j\Big(\sum_ic_{ij}\Big). This is zero for all parameter values if and only if ∑jcij=0(i=1,…,k),∑icij=0(j=1,…,r).\sum_jc_{ij}=0\ \ (i=1,\dots,k),\qquad\sum_ic_{ij}=0\ \ (j=1,\dots,r). (The condition ∑∑cij=0\sum\sum c_{ij}=0 then follows.)

Counting. The vector (cij)(c_{ij}) has krkr entries and must satisfy kk row conditions and rr column conditions. These k+rk+r conditions are not independent: adding all row conditions gives ∑∑cij=0\sum\sum c_{ij}=0, which is also the sum of all column conditions. Apart from that one relation they are independent, so there are k+r−1k+r-1 independent restrictions. Hence the number of linearly independent error contrasts is kr−(k+r−1)=kr−k−r+1=(k−1)(r−1).kr-(k+r-1)=kr-k-r+1=(k-1)(r-1).

A direct basis. Choose any cijc_{ij} freely for i=1,…,k−1i=1,\dots,k-1 and j=1,…,r−1j=1,\dots,r-1: that is (k−1)(r−1)(k-1)(r-1) free values. The last column then follows from the row conditions, the last row from the column conditions, and the corner cell (k,r)(k,r) is consistent because both routes give ∑i<k∑j<rcij\sum_{i<k}\sum_{j<r}c_{ij}. So the free choices give exactly (k−1)(r−1)(k-1)(r-1) independent contrasts, for example yij−yir−ykj+ykr,i=1,…,k−1,j=1,…,r−1.y_{ij}-y_{ir}-y_{kj}+y_{kr},\qquad i=1,\dots,k-1,\ j=1,\dots,r-1 .

Another view. The rank of the design is 1+(k−1)+(r−1)=k+r−11+(k-1)+(r-1)=k+r-1 (one for μ\mu, k−1k-1 estimable contrasts of α\alpha, r−1r-1 of β\beta). The error space is the orthogonal complement, of dimension N−rank=kr−k−r+1=(k−1)(r−1)N-\text{rank}=kr-k-r+1=(k-1)(r-1). These are exactly the error degrees of freedom in the two-way ANOVA with one observation per cell. ◼\blacksquare

✓ Proof checked step by step We checked the counting argument, and checked numerically that the residual space for a 4 × 3 table has dimension 6 = (4 − 1)(3 − 1).

↑ Back to the question list

Three sides of an equilateral triangle were measured by 5 persons with the following results:

Sides \ Persons A B C D E
a 5.44 5.41 5.43 5.42 5.43
b 5.43 5.41 5.42 5.43 5.44
c 5.45 5.42 5.43 5.43 5.44

Is there any significant difference between (i) measurements by the persons and (ii) the sides of the triangle?

2017 · Paper I · Q8a · 20 marks

Solution

Set-up. This is a two-way classification with one observation per cell: 3 sides (rows) × 5 persons (columns). To simplify, code u=100(x−5.40)u=100(x-5.40); this changes all sums of squares by the factor 10410^4 but leaves every F ratio unchanged.

Side  Person A B C D E Total
aa 4 1 3 2 3 13
bb 3 1 2 3 4 13
cc 5 2 3 3 4 17
Total 12 4 8 8 11 G=43G=43

Model. uij=μ+αi+βj+eiju_{ij}=\mu+\alpha_i+\beta_j+e_{ij}, with αi\alpha_i the side effect and βj\beta_j the person effect, eij∼N(0,σ2)e_{ij}\sim N(0,\sigma^2).

Hypotheses: H01H_{01}: no difference between persons (βj=0\beta_j=0); H02H_{02}: no difference between sides (αi=0\alpha_i=0).

Sums of squares. N=15N=15, CF=432/15=123.267\text{CF}=43^2/15=123.267, ∑u2=141\sum u^2=141. ST=141−123.267=17.733S_T=141-123.267=17.733 Ssides=132+132+1725−123.267=125.4−123.267=2.133S_{\text{sides}}=\frac{13^2+13^2+17^2}{5}-123.267=125.4-123.267=2.133 Spersons=122+42+82+82+1123−123.267=136.333−123.267=13.067S_{\text{persons}}=\frac{12^2+4^2+8^2+8^2+11^2}{3}-123.267=136.333-123.267=13.067 SE=17.733−2.133−13.067=2.533S_E=17.733-2.133-13.067=2.533

ANOVA table (coded units).

Source df SS MS F F0.05F_{0.05}
Sides 2 2.133 1.067 3.37 4.46
Persons 4 13.067 3.267 10.32 3.84
Error 8 2.533 0.317
Total 14 17.733

Conclusions (5% level).

    1. Persons: F=10.32>F0.05(4,8)=3.84F=10.32>F_{0.05}(4,8)=3.84, so the measurements made by the five persons differ significantly (p≈0.003p\approx0.003). Person B in particular reads lower than the others.
    1. Sides: F=3.37<F0.05(2,8)=4.46F=3.37<F_{0.05}(2,8)=4.46, so there is no significant difference between the three sides (p≈0.09p\approx0.09). This agrees with the triangle being equilateral.

✓ Checked by computer We re-ran the whole ANOVA in Python: SS sides 2.133, persons 13.067, error 2.533 (on the coded scale); F = 3.37 for sides and 10.32 for persons, against 4.46 and 3.84.

↑ Back to the question list

Write down the model used for one way analysis of variance. The lifetimes (in hours) of samples taken from three different brands of batteries gave the following: n1=5, n2=4, n3=6, x‾=40, y‾=55, z‾=60, ∑i=15(xi−x‾)2=400, ∑i=14(yi−y‾)2=350 and ∑i=16(zi−z‾)2=850. Test the hypothesis that there is no difference in lifetimes for the three brands. Also write down the ANOVA (F2,12,.05=3.89).

2012 · Paper I · Q6b · 20 marks

Solution

Model for one-way ANOVA. yij=μ+αi+eij,i=1,…,k;j=1,…,ni,y_{ij}=\mu+\alpha_i+e_{ij},\qquad i=1,\dots,k;\ j=1,\dots,n_i, where μ\mu is the general mean, αi\alpha_i is the effect of the ii-th class (here, brand) with ∑niαi=0\sum n_i\alpha_i=0, and the eije_{ij} are independent N(0,σ2)N(0,\sigma^2).

We test H0:α1=α2=α3=0H_0:\alpha_1=\alpha_2=\alpha_3=0 (no difference in mean lifetime) against H1H_1: not all equal.

Grand mean. N=5+4+6=15N=5+4+6=15: y‾=5(40)+4(55)+6(60)15=200+220+36015=78015=52.\bar y=\frac{5(40)+4(55)+6(60)}{15}=\frac{200+220+360}{15}=\frac{780}{15}=52 .

Between-brand SS. SB=∑ni(y‾i−y‾)2=5(40−52)2+4(55−52)2+6(60−52)2=720+36+384=1140.S_B=\sum n_i(\bar y_i-\bar y)^2=5(40-52)^2+4(55-52)^2+6(60-52)^2=720+36+384=1140 .

Within-brand SS. This is given directly: SW=400+350+850=1600.S_W=400+350+850=1600 .

ANOVA table.

Source df SS MS F
Between brands 2 1140 570.0 4.275
Within brands (error) 12 1600 133.3
Total 14 2740

Decision. F=570/133.33=4.275>F2,12,0.05=3.89F=570/133.33=4.275>F_{2,12,0.05}=3.89. We reject H0H_0 at the 5% level: the three brands differ significantly in mean lifetime. The first brand (mean 40 hours) is clearly the weakest.

✓ Checked by computer We recomputed in Python: grand mean 52, between SS 1140, within SS 1600, F = 4.275 against 3.89 (p ≈ 0.040).

↑ Back to the question list

Discuss the two-way analysis of variance model giving its analysis and ANOVA table.

2006 · Paper I · Q8a · 20 marks

Solution

Data. A two-way layout: factor A (rows) at pp levels, factor B (columns) at qq levels, one observation yijy_{ij} per cell. (The case with rr observations per cell, which adds an interaction line, is in Q1.)

Model. yij=μ+αi+βj+eij,∑iαi=0,∑jβj=0,eij∼iidN(0,σ2).y_{ij}=\mu+\alpha_i+\beta_j+e_{ij},\qquad\sum_i\alpha_i=0,\ \sum_j\beta_j=0,\qquad e_{ij}\stackrel{iid}\sim N(0,\sigma^2). The effects are assumed additive: there is no interaction, which cannot be estimated with one observation per cell.

Least squares. Minimising ∑∑(yij−μ−αi−βj)2\sum\sum(y_{ij}-\mu-\alpha_i-\beta_j)^2 gives the normal equations pqμ=G,qμ+qαi=Ri,pμ+pβj=Cj,pq\mu=G,\qquad q\mu+q\alpha_i=R_i,\qquad p\mu+p\beta_j=C_j, where RiR_i, CjC_j and GG are the row, column and grand totals. With the side conditions: μ̂=y‾⋅⋅,α̂i=y‾i⋅−y‾⋅⋅,β̂j=y‾⋅j−y‾⋅⋅.\hat\mu=\bar y_{\cdot\cdot},\qquad\hat\alpha_i=\bar y_{i\cdot}-\bar y_{\cdot\cdot},\qquad\hat\beta_j=\bar y_{\cdot j}-\bar y_{\cdot\cdot}.

Split of the sum of squares. yij−y‾⋅⋅=(y‾i⋅−y‾⋅⋅)+(y‾⋅j−y‾⋅⋅)+(yij−y‾i⋅−y‾⋅j+y‾⋅⋅).y_{ij}-\bar y_{\cdot\cdot}=(\bar y_{i\cdot}-\bar y_{\cdot\cdot})+(\bar y_{\cdot j}-\bar y_{\cdot\cdot})+(y_{ij}-\bar y_{i\cdot}-\bar y_{\cdot j}+\bar y_{\cdot\cdot}). Squaring and summing, the cross-products vanish (each term sums to zero over the index it lacks), so ST=q∑i(y‾i⋅−y‾⋅⋅)2+p∑j(y‾⋅j−y‾⋅⋅)2+∑ij(yij−y‾i⋅−y‾⋅j+y‾⋅⋅)2=SA+SB+SE.S_T=q\sum_i(\bar y_{i\cdot}-\bar y_{\cdot\cdot})^2+p\sum_j(\bar y_{\cdot j}-\bar y_{\cdot\cdot})^2+\sum_{ij}(y_{ij}-\bar y_{i\cdot}-\bar y_{\cdot j}+\bar y_{\cdot\cdot})^2=S_A+S_B+S_E .

Expected mean squares. E(MA)=σ2+qp−1∑αi2,E(MB)=σ2+pq−1∑βj2,E(ME)=σ2.E(M_A)=\sigma^2+\frac{q}{p-1}\sum\alpha_i^2,\qquad E(M_B)=\sigma^2+\frac p{q-1}\sum\beta_j^2,\qquad E(M_E)=\sigma^2 . By Cochran’s theorem, SA/σ2S_A/\sigma^2, SB/σ2S_B/\sigma^2 and SE/σ2S_E/\sigma^2 are independent chi-squares (central under the respective nulls).

ANOVA table.

Source df SS MS F
A (rows) p−1p-1 SA=1q∑Ri2−CFS_A=\frac1q\sum R_i^2-\text{CF} MAM_A MA/ME∼Fp−1,(p−1)(q−1)M_A/M_E\sim F_{p-1,(p-1)(q-1)}
B (columns) q−1q-1 SB=1p∑Cj2−CFS_B=\frac1p\sum C_j^2-\text{CF} MBM_B MB/ME∼Fq−1,(p−1)(q−1)M_B/M_E\sim F_{q-1,(p-1)(q-1)}
Error (p−1)(q−1)(p-1)(q-1) SE=ST−SA−SBS_E=S_T-S_A-S_B MEM_E
Total pq−1pq-1 ST=∑yij2−CFS_T=\sum y_{ij}^2-\text{CF}

with CF=G2/pq\text{CF}=G^2/pq. We reject H0A:αi=0H_{0A}:\alpha_i=0 when MA/MEM_A/M_E exceeds the upper α\alpha point of Fp−1,(p−1)(q−1)F_{p-1,(p-1)(q-1)}, and H0BH_{0B} similarly.

✓ Derivation checked step by step Every step was checked: the least squares estimates, the orthogonal split of the total sum of squares and the expected mean squares.

↑ Back to the question list

Describe Tukey’s test for non-additivity for a two-way layout with one observation per cell.

2005 · Paper I · Q5b · 12 marks

Solution

Problem. With one observation per cell, the two-way model yij=μ+αi+βj+eijy_{ij}=\mu+\alpha_i+\beta_j+e_{ij} uses the interaction degrees of freedom as error. If the factors in fact interact, the “error” is inflated and the tests lose power. Tukey (1949) gave a test for one particular, common type of non-additivity using just one degree of freedom.

Idea. Suppose the interaction is a multiple of the product of the main effects: yij=μ+αi+βj+γαiβj+eij.y_{ij}=\mu+\alpha_i+\beta_j+\gamma\,\alpha_i\beta_j+e_{ij}. This happens, for instance, when the effects are really multiplicative, so that a log or power transformation would make them additive. We test H0:γ=0H_0:\gamma=0.

Computation. Let a=pa=p rows and b=qb=q columns, α̂i=y‾i⋅−y‾⋅⋅\hat\alpha_i=\bar y_{i\cdot}-\bar y_{\cdot\cdot} and β̂j=y‾⋅j−y‾⋅⋅\hat\beta_j=\bar y_{\cdot j}-\bar y_{\cdot\cdot}.

  1. Compute P=∑i∑jα̂iβ̂jyij=∑i∑j(y‾i⋅−y‾⋅⋅)(y‾⋅j−y‾⋅⋅)yij.P=\sum_i\sum_j\hat\alpha_i\hat\beta_j\,y_{ij}=\sum_i\sum_j(\bar y_{i\cdot}-\bar y_{\cdot\cdot})(\bar y_{\cdot j}-\bar y_{\cdot\cdot})y_{ij}.
  2. The sum of squares for non-additivity, on 1 df, is SN=P2∑iα̂i2∑jβ̂j2.S_N=\frac{P^2}{\sum_i\hat\alpha_i^2\ \sum_j\hat\beta_j^2}.
  3. The usual residual sum of squares SES_E (on (a−1)(b−1)(a-1)(b-1) df) is split into SNS_N and a remainder: SR=SE−SNon (a−1)(b−1)−1df.S_R=S_E-S_N\quad\text{on }(a-1)(b-1)-1\ \text{df}.
  4. Under H0H_0 (additivity), SN/σ2∼χ12S_N/\sigma^2\sim\chi^2_1 and SR/σ2∼χ(a−1)(b−1)−12S_R/\sigma^2\sim\chi^2_{(a-1)(b-1)-1} independently, so F=SNSR/{(a−1)(b−1)−1}∼F1,(a−1)(b−1)−1.F=\frac{S_N}{S_R/\{(a-1)(b-1)-1\}}\sim F_{1,\ (a-1)(b-1)-1}.

Why this works. SNS_N is the regression sum of squares when the residuals yij−y‾i⋅−y‾⋅j+y‾⋅⋅y_{ij}-\bar y_{i\cdot}-\bar y_{\cdot j}+\bar y_{\cdot\cdot} are regressed on the products α̂iβ̂j\hat\alpha_i\hat\beta_j. Conditionally on the row and column means, those products are fixed and lie in the interaction space, so the usual regression argument gives the χ12\chi^2_1 distribution and its independence from the remainder.

ANOVA layout.

Source df SS
Rows a−1a-1 SAS_A
Columns b−1b-1 SBS_B
Non-additivity 1 SNS_N
Remainder (a−1)(b−1)−1(a-1)(b-1)-1 SRS_R
Total ab−1ab-1 STS_T

Use. A significant FF suggests the data should be transformed (for example y1−γ̂y‾y^{1-\hat\gamma\bar y}, or logs) before the additive analysis, or that the interaction should be modelled.

✓ Derivation checked step by step Every step was checked: Tukey’s one-degree-of-freedom sum of squares, its independence from the remaining error, and the resulting F test.

↑ Back to the question list

Cover of the UPSC Mains Topic-wise and Year-wise PYQs book (2013–2026)

From the Optional Province team

Strengthen your GS papers

Our UPSC Mains Topic-wise & Year-wise PYQ Book (2013–2026) maps every GS question to the syllabus, so you know what UPSC asks and how often. Now available as a hard copy and an eBook.

Buy Hard Copy on AmazonBuy eBook (PDF)

Download a free sample

Explain the concept of one-way classified data. Write the linear model for it Obtain the least square estimate of the parameters involved in it.

2003 · Paper I · Q6c · 20 marks

Solution

One-way classified data. The NN observations are grouped according to one factor (one criterion of classification) into kk classes, for example yields of kk varieties of a crop, or marks of students taught by kk methods. Class ii has nin_i observations, ∑ni=N\sum n_i=N. The aim is to compare the class means.

Linear model. yij=μ+αi+eij,i=1,…,k;j=1,…,ni,y_{ij}=\mu+\alpha_i+e_{ij},\qquad i=1,\dots,k;\ j=1,\dots,n_i, where μ\mu is the general mean, αi\alpha_i the effect of class ii, and the eije_{ij} are independent N(0,σ2)N(0,\sigma^2). In matrix form Y=Xβ+eY=X\beta+e with β=(μ,α1,…,αk)′\beta=(\mu,\alpha_1,\dots,\alpha_k)'. XX has rank kk, not k+1k+1 (its first column is the sum of the others), so we need one side condition, usually ∑niαi=0\sum n_i\alpha_i=0.

Least squares. Minimise S=∑i∑j(yij−μ−αi)2.S=\sum_i\sum_j(y_{ij}-\mu-\alpha_i)^2 . ∂S∂μ=0:Nμ+∑iniαi=G=∑∑yij,\frac{\partial S}{\partial\mu}=0:\quad N\mu+\sum_in_i\alpha_i=G=\sum\sum y_{ij}, ∂S∂αi=0:niμ+niαi=Ti=∑jyij,i=1,…,k.\frac{\partial S}{\partial\alpha_i}=0:\quad n_i\mu+n_i\alpha_i=T_i=\sum_jy_{ij},\qquad i=1,\dots,k . The kk equations in the second line add up to the first, so only kk are independent. Using ∑niαi=0\sum n_i\alpha_i=0: μ̂=GN=y‾⋅⋅,α̂i=Tini−μ̂=y‾i⋅−y‾⋅⋅.\hat\mu=\frac GN=\bar y_{\cdot\cdot},\qquad\hat\alpha_i=\frac{T_i}{n_i}-\hat\mu=\bar y_{i\cdot}-\bar y_{\cdot\cdot}.

So the fitted value for class ii is the class mean y‾i⋅\bar y_{i\cdot}. The estimable quantities, such as μ+αi\mu+\alpha_i and the contrasts ∑ciαi\sum c_i\alpha_i with ∑ci=0\sum c_i=0, do not depend on the side condition chosen; for example αi−αi′̂=y‾i⋅−y‾i′⋅\widehat{\alpha_i-\alpha_{i'}}=\bar y_{i\cdot}-\bar y_{i'\cdot}.

Error variance. The residual sum of squares is SE=∑∑(yij−y‾i⋅)2S_E=\sum\sum(y_{ij}-\bar y_{i\cdot})^2 on N−kN-k df, and σ̂2=SEN−k\hat\sigma^2=\frac{S_E}{N-k} is unbiased for σ2\sigma^2. It is used to test H0:α1=…=αk=0H_0:\alpha_1=\dots=\alpha_k=0 with F=SB/(k−1)SE/(N−k)F=\dfrac{S_B/(k-1)}{S_E/(N-k)}, where SB=∑ni(y‾i⋅−y‾⋅⋅)2S_B=\sum n_i(\bar y_{i\cdot}-\bar y_{\cdot\cdot})^2.

✓ Derivation checked step by step Every step was checked: the normal equations and the least squares estimates under the side condition, which reproduce the class means.

↑ Back to the question list

Describe an appropriate test for equality of means of several populations on the basis of independent samples drawn from them.

2001 · Paper I · Q6iii · 15 marks

Solution

Problem. We have independent samples of sizes n1,…,nkn_1,\dots,n_k from kk normal populations N(μi,σ2)N(\mu_i,\sigma^2) with a common variance. We test H0:μ1=μ2=…=μkagainstH1:not all equal.H_0:\mu_1=\mu_2=\dots=\mu_k\quad\text{against}\quad H_1:\text{not all equal}. For k=2k=2 this is the two-sample tt test; for k>2k>2 the right test is the one-way analysis of variance.

Notation. N=∑niN=\sum n_i, y‾i\bar y_i is the mean of sample ii, y‾\bar y the overall mean.

Split of the total variation. ∑i∑j(yij−y‾)2=∑ini(y‾i−y‾)2+∑i∑j(yij−y‾i)2,\sum_i\sum_j(y_{ij}-\bar y)^2=\sum_in_i(\bar y_i-\bar y)^2+\sum_i\sum_j(y_{ij}-\bar y_i)^2, that is, ST=SB+SWS_T=S_B+S_W, total = between samples + within samples. The cross-product vanishes because ∑j(yij−y‾i)=0\sum_j(y_{ij}-\bar y_i)=0.

Distributions.

  • Whatever the means, SW/σ2∼χN−k2S_W/\sigma^2\sim\chi^2_{N-k} (it is the sum of kk independent within-sample sums of squares, with ni−1n_i-1 df each).
  • Under H0H_0, SB/σ2∼χk−12S_B/\sigma^2\sim\chi^2_{k-1}, independent of SWS_W (the sample means are independent of the sample variances for normal samples).
  • In general E(SB)=(k−1)σ2+∑ni(μi−μ‾)2E(S_B)=(k-1)\sigma^2+\sum n_i(\mu_i-\bar\mu)^2, with μ‾=∑niμi/N\bar\mu=\sum n_i\mu_i/N.

Test. F=SB/(k−1)SW/(N−k)∼Fk−1,N−kunder H0.F=\frac{S_B/(k-1)}{S_W/(N-k)}\sim F_{k-1,\,N-k}\quad\text{under }H_0 . Large values of FF indicate unequal means, because the numerator then tends to exceed σ2\sigma^2 while the denominator does not. We reject H0H_0 at level α\alpha if F>Fα(k−1,N−k)F>F_\alpha(k-1,N-k).

Source df SS MS F
Between samples k−1k-1 SBS_B SB/(k−1)S_B/(k-1) FF
Within samples N−kN-k SWS_W SW/(N−k)S_W/(N-k)
Total N−1N-1 STS_T

Remarks.

  • This FF test is the likelihood ratio test for H0H_0.
  • Before it, check the common-variance assumption, for example with Bartlett’s test. If the normality assumption is doubtful, use the Kruskal–Wallis rank test.
  • If H0H_0 is rejected, compare pairs with the critical difference tα/2,N−kσ̂2(1/ni+1/ni′)t_{\alpha/2,N-k}\sqrt{\hat\sigma^2(1/n_i+1/n_{i'})}, or with Tukey’s or Scheffé’s method.

✓ Derivation checked step by step Every step was checked: the split of the total sum of squares, the chi-square distributions and the F statistic for the one-way analysis of variance.

↑ Back to the question list

In the case of two-way classified data with unequal number of observations per cell derive the expectation of the MS components of the ANOVA table.

1998 · Paper I · Q9c · 20 marks

Solution

Model. Rows (A) i=1,…,pi=1,\dots,p, columns (B) j=1,…,qj=1,\dots,q, with nij≥1n_{ij}\ge1 observations in cell (i,j)(i,j) and no interaction: yijk=μ+αi+βj+eijk,eijk∼iidN(0,σ2).y_{ijk}=\mu+\alpha_i+\beta_j+e_{ijk},\qquad e_{ijk}\stackrel{iid}\sim N(0,\sigma^2). Write ni⋅=∑jnijn_{i\cdot}=\sum_jn_{ij}, n⋅j=∑inijn_{\cdot j}=\sum_in_{ij}, N=∑∑nijN=\sum\sum n_{ij}, and RiR_i, CjC_j, GG for the row, column and grand totals.

With unequal nijn_{ij} the rows and columns are not orthogonal, so the ANOVA uses the method of fitting constants: ST=SB⏟columns, ignoring rows+SA∣B⏟rows, eliminating columns+SE.S_T=\underbrace{S_{B}}_{\text{columns, ignoring rows}}+\underbrace{S_{A\mid B}}_{\text{rows, eliminating columns}}+S_E .

A key result. If QQ is a quadratic form in the observations, Y′AYY'AY with E(Y)=mE(Y)=m and V(Y)=σ2IV(Y)=\sigma^2I, then E(Y′AY)=σ2tr(A)+m′Am.E(Y'AY)=\sigma^2\,\text{tr}(A)+m'Am . When AA is a projection matrix (symmetric and idempotent), tr(A)=rank(A)\text{tr}(A)=\text{rank}(A) = the degrees of freedom.

(1) Error. SE=Y′(I−P)YS_E=Y'(I-P)Y, where PP projects onto the column space of the full design (rank p+q−1p+q-1). Since (I−P)m=0(I-P)m=0, E(SE)=(N−p−q+1)σ2,E(ME)=σ2.E(S_E)=(N-p-q+1)\sigma^2,\qquad E(M_E)=\sigma^2 .

(2) Columns, ignoring rows. SB=∑jCj2/n⋅j−G2/N=Y′(PB−P1)YS_B=\sum_jC_j^2/n_{\cdot j}-G^2/N=Y'(P_B-P_1)Y, a projection of rank q−1q-1. So E(SB)=(q−1)σ2+∑jn⋅j(m‾⋅j−m‾)2,E(S_B)=(q-1)\sigma^2+\sum_jn_{\cdot j}\big(\bar m_{\cdot j}-\bar m\big)^2, where m‾⋅j=E(Cj)/n⋅j=μ+βj+∑inijαi/n⋅j\bar m_{\cdot j}=E(C_j)/n_{\cdot j}=\mu+\beta_j+\sum_in_{ij}\alpha_i/n_{\cdot j} and m‾=∑jn⋅jm‾⋅j/N\bar m=\sum_jn_{\cdot j}\bar m_{\cdot j}/N. Even when βj=0\beta_j=0 this expectation contains row effects, which is why SBS_B cannot be used to test B unless the rows are eliminated.

(3) Rows, eliminating columns. SA∣B=Y′(P−PB)YS_{A\mid B}=Y'(P-P_B)Y, a projection of rank p−1p-1. The column effects lie in the space of PBP_B, so they drop out: E(SA∣B)=(p−1)σ2+α′Cα,E(MA∣B)=σ2+α′Cαp−1,E(S_{A\mid B})=(p-1)\sigma^2+\alpha'C\alpha,\qquad E(M_{A\mid B})=\sigma^2+\frac{\alpha'C\alpha}{p-1}, where CC is the matrix of the reduced normal equations for α\alpha after μ\mu and β\beta are eliminated: Cii=ni⋅−∑jnij2n⋅j,Cii′=−∑jnijni′jn⋅j(i≠i′).C_{ii}=n_{i\cdot}-\sum_j\frac{n_{ij}^2}{n_{\cdot j}},\qquad C_{ii'}=-\sum_j\frac{n_{ij}n_{i'j}}{n_{\cdot j}}\ (i\ne i'). Thus α′Cα=∑ini⋅αi2−∑j(∑inijαi)2/n⋅j\alpha'C\alpha=\sum_in_{i\cdot}\alpha_i^2-\sum_j\big(\sum_in_{ij}\alpha_i\big)^2/n_{\cdot j}, which is zero exactly when H0A:αi=0H_{0A}:\alpha_i=0 holds.

The same argument with the roles reversed gives E(SB∣A)=(q−1)σ2+β′DβE(S_{B\mid A})=(q-1)\sigma^2+\beta'D\beta, and the unadjusted row SS SA=∑Ri2/ni⋅−G2/NS_A=\sum R_i^2/n_{i\cdot}-G^2/N has E(SA)=(p−1)σ2+∑ini⋅(m‾i⋅−m‾)2,m‾i⋅=μ+αi+∑jnijβjni⋅.E(S_A)=(p-1)\sigma^2+\sum_in_{i\cdot}(\bar m_{i\cdot}-\bar m)^2,\qquad\bar m_{i\cdot}=\mu+\alpha_i+\frac{\sum_jn_{ij}\beta_j}{n_{i\cdot}}.

ANOVA table.

Source df SS E(MS)
Columns (ignoring rows) q−1q-1 SBS_B σ2+∑n⋅j(m‾⋅j−m‾)2/(q−1)\sigma^2+\sum n_{\cdot j}(\bar m_{\cdot j}-\bar m)^2/(q-1)
Rows (eliminating columns) p−1p-1 SA∣BS_{A\mid B} σ2+α′Cα/(p−1)\sigma^2+\alpha'C\alpha/(p-1)
Error N−p−q+1N-p-q+1 SES_E σ2\sigma^2
Total N−1N-1 STS_T

With equal nij=rn_{ij}=r, C=qr(I−1pJ)C=qr(I-\tfrac1pJ), so α′Cα=qr∑αi2\alpha'C\alpha=qr\sum\alpha_i^2 and we recover the familiar results of Q14.

✓ Derivation checked step by step We checked the derivation, and checked by simulation for a 3 × 3 layout with unequal cell sizes that the expectation of the unadjusted row sum of squares matches the formula (13.01 simulated against 12.95).

↑ Back to the question list

Define contrasts, orthogonal contrasts and show that SS due to n observations is equal to the total SS due to the orthogonal contrasts.

1998 · Paper I · Q10a · 20 marks

Solution

Definitions. Let y1,…,yny_1,\dots,y_n be observations (or treatment totals).

  • A linear contrast is L=∑iciyiL=\sum_ic_iy_i with ∑ici=0\sum_ic_i=0.
  • Two contrasts L1=∑c1iyiL_1=\sum c_{1i}y_i and L2=∑c2iyiL_2=\sum c_{2i}y_i are orthogonal if ∑ic1ic2i=0\sum_ic_{1i}c_{2i}=0. When the yiy_i are independent with common variance σ2\sigma^2, orthogonal contrasts are uncorrelated (independent under normality), since Cov(L1,L2)=σ2∑c1ic2i\text{Cov}(L_1,L_2)=\sigma^2\sum c_{1i}c_{2i}.
  • The sum of squares due to a contrast L=∑ciyiL=\sum c_iy_i is SL=L2/∑ci2S_L=L^2/\sum c_i^2, on 1 df.

Result. If L1,…,Ln−1L_1,\dots,L_{n-1} are mutually orthogonal contrasts, then ∑r=1n−1Lr2∑icri2=∑i=1n(yi−y‾)2.\sum_{r=1}^{n-1}\frac{L_r^2}{\sum_ic_{ri}^2}=\sum_{i=1}^n(y_i-\bar y)^2 . (Including the “total” L0=∑yiL_0=\sum y_i, with c0i=1c_{0i}=1, gives ∑r=0n−1Lr2/∑cri2=∑yi2\sum_{r=0}^{n-1}L_r^2/\sum c_{ri}^2=\sum y_i^2, the raw SS of the nn observations.)

Proof. Normalise each contrast: ur=cr/∥cr∥u_r=c_r/\|c_r\|, so Lr/∥cr∥=ur′yL_r/\|c_r\|=u_r'y. Put u0=(1,…,1)′/nu_0=(1,\dots,1)'/\sqrt n. Since each crc_r sums to zero, ur⊥u0u_r\perp u_0, and the uru_r are mutually orthogonal unit vectors. So u0,u1,…,un−1u_0,u_1,\dots,u_{n-1} are nn orthonormal vectors in ℝn\mathbb R^n, and the matrix UU with these rows is orthogonal: U′U=IU'U=I.

Then z=Uyz=Uy satisfies z′z=y′U′Uy=y′yz'z=y'U'Uy=y'y, that is, ∑r=0n−1(ur′y)2=∑iyi2.\sum_{r=0}^{n-1}(u_r'y)^2=\sum_iy_i^2 . The first term is (u0′y)2=(∑yi)2/n=ny‾2(u_0'y)^2=(\sum y_i)^2/n=n\bar y^2, the correction factor. Hence ∑r=1n−1Lr2∑icri2=∑iyi2−ny‾2=∑i(yi−y‾)2.◼\sum_{r=1}^{n-1}\frac{L_r^2}{\sum_ic_{ri}^2}=\sum_iy_i^2-n\bar y^2=\sum_i(y_i-\bar y)^2. \qquad\blacksquare

Meaning. The n−1n-1 df of the total (corrected) sum of squares can be split into n−1n-1 independent single-df components, one for each orthogonal contrast. This is how, for example, treatment sums of squares in factorial experiments are split into main effects and interactions.

Example. For n=3n=3, the contrasts y1−y2y_1-y_2 and y1+y2−2y3y_1+y_2-2y_3 are orthogonal, and (y1−y2)22+(y1+y2−2y3)26=∑(yi−y‾)2.\frac{(y_1-y_2)^2}{2}+\frac{(y_1+y_2-2y_3)^2}{6}=\sum(y_i-\bar y)^2 .

✓ Proof checked step by step We checked the proof, and checked in Python with Helmert contrasts for n = 5 that the sum of the contrast sums of squares equals the total sum of squares.

↑ Back to the question list

Write down the model of a complete three-way classified data with equal number of observations per cell. Write down the corresponding ANOVA table.

1996 · Paper I · Q10c · 15 marks

Solution

Model. Factors A, B, C at aa, bb, cc levels, with rr observations in every cell: yijkl=μ+αi+βj+γk+(αβ)ij+(αγ)ik+(βγ)jk+(αβγ)ijk+eijkl,y_{ijkl}=\mu+\alpha_i+\beta_j+\gamma_k+(\alpha\beta)_{ij}+(\alpha\gamma)_{ik}+(\beta\gamma)_{jk}+(\alpha\beta\gamma)_{ijk}+e_{ijkl}, with i=1..ai=1..a, j=1..bj=1..b, k=1..ck=1..c, l=1..rl=1..r. All effects are fixed and sum to zero over each of their subscripts, and eijkl∼iidN(0,σ2)e_{ijkl}\stackrel{iid}\sim N(0,\sigma^2).

Sums of squares (with CF=G2/abcr\text{CF}=G^2/abcr and the various marginal totals TT):

  • SA=1bcr∑iTi2−CFS_A=\frac1{bcr}\sum_iT_{i}^2-\text{CF}, and similarly SBS_B and SCS_C.
  • SAB=1cr∑ijTij2−CF−SA−SBS_{AB}=\frac1{cr}\sum_{ij}T_{ij}^2-\text{CF}-S_A-S_B, and similarly SACS_{AC} and SBCS_{BC}.
  • SABC=1r∑ijkTijk2−CF−SA−SB−SC−SAB−SAC−SBCS_{ABC}=\frac1r\sum_{ijk}T_{ijk}^2-\text{CF}-S_A-S_B-S_C-S_{AB}-S_{AC}-S_{BC}.
  • SE=∑y2−1r∑ijkTijk2S_E=\sum y^2-\frac1r\sum_{ijk}T_{ijk}^2 (within cells), and ST=∑y2−CFS_T=\sum y^2-\text{CF}.

ANOVA table.

Source df MS E(MS) F
A a−1a-1 MAM_A σ2+bcra−1∑αi2\sigma^2+\frac{bcr}{a-1}\sum\alpha_i^2 MA/MEM_A/M_E
B b−1b-1 MBM_B σ2+acrb−1∑βj2\sigma^2+\frac{acr}{b-1}\sum\beta_j^2 MB/MEM_B/M_E
C c−1c-1 MCM_C σ2+abrc−1∑γk2\sigma^2+\frac{abr}{c-1}\sum\gamma_k^2 MC/MEM_C/M_E
AB (a−1)(b−1)(a-1)(b-1) MABM_{AB} σ2+cr∑(αβ)2(a−1)(b−1)\sigma^2+\frac{cr\sum(\alpha\beta)^2}{(a-1)(b-1)} MAB/MEM_{AB}/M_E
AC (a−1)(c−1)(a-1)(c-1) MACM_{AC} σ2+br∑(αγ)2(a−1)(c−1)\sigma^2+\frac{br\sum(\alpha\gamma)^2}{(a-1)(c-1)} MAC/MEM_{AC}/M_E
BC (b−1)(c−1)(b-1)(c-1) MBCM_{BC} σ2+ar∑(βγ)2(b−1)(c−1)\sigma^2+\frac{ar\sum(\beta\gamma)^2}{(b-1)(c-1)} MBC/MEM_{BC}/M_E
ABC (a−1)(b−1)(c−1)(a-1)(b-1)(c-1) MABCM_{ABC} σ2+r∑(αβγ)2(a−1)(b−1)(c−1)\sigma^2+\frac{r\sum(\alpha\beta\gamma)^2}{(a-1)(b-1)(c-1)} MABC/MEM_{ABC}/M_E
Error abc(r−1)abc(r-1) MEM_E σ2\sigma^2
Total abcr−1abcr-1

The degrees of freedom add up: (a−1)+(b−1)+(c−1)+(a−1)(b−1)+(a−1)(c−1)+(b−1)(c−1)+(a−1)(b−1)(c−1)=abc−1(a-1)+(b-1)+(c-1)+(a-1)(b-1)+(a-1)(c-1)+(b-1)(c-1)+(a-1)(b-1)(c-1)=abc-1 for the cells, plus abc(r−1)abc(r-1) within cells, giving abcr−1abcr-1.

Each FF is compared with FαF_\alpha on its own df and abc(r−1)abc(r-1). As usual, the highest-order interaction is examined first. (With r=1r=1 there is no within-cell error, and SABCS_{ABC} is used as error, assuming the three-factor interaction is negligible.)

✓ Derivation checked step by step Every step was checked: the model with all interactions, the degrees of freedom (which add to abcr − 1) and the expected mean squares used for the F ratios.

↑ Back to the question list

Describe the model and the analysis of variance of a complete two-way classified data with equal (>1) number of observations per cell. State clearly what you will do if the interaction effects (i) are not significant (ii) are significant.

1995 · Paper I · Q9a · 30 marks

Solution

Model. A at pp levels, B at qq levels, r>1r>1 observations per cell: yijk=μ+αi+βj+(αβ)ij+eijk,y_{ijk}=\mu+\alpha_i+\beta_j+(\alpha\beta)_{ij}+e_{ijk}, with fixed effects summing to zero over each subscript and eijk∼iidN(0,σ2)e_{ijk}\stackrel{iid}\sim N(0,\sigma^2).

Analysis of variance. With cell totals TijT_{ij}, row totals RiR_i, column totals CjC_j, grand total GG and CF=G2/pqr\text{CF}=G^2/pqr: SA=∑Ri2qr−CF,SB=∑Cj2pr−CF,SAB=∑∑Tij2r−CF−SA−SB,S_A=\frac{\sum R_i^2}{qr}-\text{CF},\quad S_B=\frac{\sum C_j^2}{pr}-\text{CF},\quad S_{AB}=\frac{\sum\sum T_{ij}^2}r-\text{CF}-S_A-S_B, SE=∑yijk2−∑∑Tij2r,ST=∑yijk2−CF.S_E=\sum y_{ijk}^2-\frac{\sum\sum T_{ij}^2}{r},\qquad S_T=\sum y_{ijk}^2-\text{CF}.

Source df SS MS E(MS) F
A p−1p-1 SAS_A MAM_A σ2+qr∑αi2p−1\sigma^2+\frac{qr\sum\alpha_i^2}{p-1} MA/MEM_A/M_E
B q−1q-1 SBS_B MBM_B σ2+pr∑βj2q−1\sigma^2+\frac{pr\sum\beta_j^2}{q-1} MB/MEM_B/M_E
AB (p−1)(q−1)(p-1)(q-1) SABS_{AB} MABM_{AB} σ2+r∑∑(αβ)ij2(p−1)(q−1)\sigma^2+\frac{r\sum\sum(\alpha\beta)_{ij}^2}{(p-1)(q-1)} MAB/MEM_{AB}/M_E
Error pq(r−1)pq(r-1) SES_E MEM_E σ2\sigma^2
Total pqr−1pqr-1 STS_T

The interaction is tested first, with F=MAB/MEF=M_{AB}/M_E on (p−1)(q−1)(p-1)(q-1) and pq(r−1)pq(r-1) df.

(i) Interaction not significant. The factors act additively: the difference between two levels of A is the same at every level of B.

  • Test the main effects with MA/MEM_A/M_E and MB/MEM_B/M_E.
  • If the interaction is clearly negligible (some use the rule F<2F<2), pool it with error, SE′=SE+SABS_E'=S_E+S_{AB} on pq(r−1)+(p−1)(q−1)pq(r-1)+(p-1)(q-1) df, to get a more precise error estimate, and test A and B against SE′/dfS_E'/\text{df}.
  • For a significant main effect, compare the level means y‾i⋅⋅\bar y_{i\cdot\cdot} using the critical difference tα/2,ν2ME/qrt_{\alpha/2,\nu}\sqrt{2M_E/qr} (and 2ME/pr\sqrt{2M_E/pr} for B). The best level of A is then best at every level of B.

(ii) Interaction significant. The effect of A depends on the level of B, so the main-effect tests (averaged over the other factor) can mislead and are usually not interpreted on their own.

  • Study the cell means y‾ij⋅\bar y_{ij\cdot}, for example with an interaction plot.
  • Compare the levels of A separately at each level of B (simple effects), using the critical difference tα/2,pq(r−1)2ME/rt_{\alpha/2,pq(r-1)}\sqrt{2M_E/r}. Each simple effect can also be tested with its own SS, ∑iTij2/r−(∑iTij)2/pr\sum_i T_{ij}^2/r-(\sum_iT_{ij})^2/pr on p−1p-1 df, against MEM_E.
  • Recommend the best combination (i,j)(i,j) rather than a best level of each factor.
  • In a random or mixed model, a significant interaction also changes the denominator: main effects are then tested against MABM_{AB}, not MEM_E.

✓ Answer checked step by step Every step was checked: the model, the sums of squares, the degrees of freedom, the expected mean squares, and the follow-up procedures for significant and non-significant interaction.

↑ Back to the question list

In the case of two-way classified data with one observation per cell derive the expectations of the MS components of the ANOVA table.

1995 · Paper I · Q9b · 30 marks

Solution

Model. One observation per cell, rows i=1,…,pi=1,\dots,p and columns j=1,…,qj=1,\dots,q: yij=μ+αi+βj+eij,∑αi=∑βj=0,eij∼iidN(0,σ2).y_{ij}=\mu+\alpha_i+\beta_j+e_{ij},\qquad\sum\alpha_i=\sum\beta_j=0,\qquad e_{ij}\stackrel{iid}\sim N(0,\sigma^2).

Means of the model: y‾i⋅=μ+αi+e‾i⋅\bar y_{i\cdot}=\mu+\alpha_i+\bar e_{i\cdot}, y‾⋅j=μ+βj+e‾⋅j\bar y_{\cdot j}=\mu+\beta_j+\bar e_{\cdot j}, y‾⋅⋅=μ+e‾⋅⋅\bar y_{\cdot\cdot}=\mu+\bar e_{\cdot\cdot}.

We use the fact that for independent ee’s with variance σ2\sigma^2, the expected sum of squared deviations of mm means, each of nn observations, about their mean is (m−1)σ2/n(m-1)\sigma^2/n.

Rows. SA=q∑i(y‾i⋅−y‾⋅⋅)2=q∑i(αi+e‾i⋅−e‾⋅⋅)2.S_A=q\sum_i(\bar y_{i\cdot}-\bar y_{\cdot\cdot})^2=q\sum_i(\alpha_i+\bar e_{i\cdot}-\bar e_{\cdot\cdot})^2 . Expanding, the cross term has expectation zero, so E(SA)=q∑αi2+qE∑i(e‾i⋅−e‾⋅⋅)2=q∑αi2+q⋅(p−1)σ2q=q∑αi2+(p−1)σ2.E(S_A)=q\sum\alpha_i^2+q\,E\sum_i(\bar e_{i\cdot}-\bar e_{\cdot\cdot})^2=q\sum\alpha_i^2+q\cdot\frac{(p-1)\sigma^2}{q}=q\sum\alpha_i^2+(p-1)\sigma^2 . E(MA)=E(SAp−1)=σ2+qp−1∑iαi2.E(M_A)=E\Big(\frac{S_A}{p-1}\Big)=\sigma^2+\frac{q}{p-1}\sum_i\alpha_i^2 .

Columns. In the same way, E(MB)=σ2+pq−1∑jβj2.E(M_B)=\sigma^2+\frac p{q-1}\sum_j\beta_j^2 .

Error. The residual is free of the parameters: yij−y‾i⋅−y‾⋅j+y‾⋅⋅=eij−e‾i⋅−e‾⋅j+e‾⋅⋅.y_{ij}-\bar y_{i\cdot}-\bar y_{\cdot j}+\bar y_{\cdot\cdot}=e_{ij}-\bar e_{i\cdot}-\bar e_{\cdot j}+\bar e_{\cdot\cdot}. Then E∑∑eij2=pqσ2,E(q∑e‾i⋅2)=pσ2,E(p∑e‾⋅j2)=qσ2,E(pqe‾⋅⋅2)=σ2,E\sum\sum e_{ij}^2=pq\sigma^2,\quad E\Big(q\sum\bar e_{i\cdot}^2\Big)=p\sigma^2,\quad E\Big(p\sum\bar e_{\cdot j}^2\Big)=q\sigma^2,\quad E(pq\,\bar e_{\cdot\cdot}^2)=\sigma^2, and the identity ∑∑(eij−e‾i⋅−e‾⋅j+e‾⋅⋅)2=∑∑eij2−q∑e‾i⋅2−p∑e‾⋅j2+pqe‾⋅⋅2\sum\sum(e_{ij}-\bar e_{i\cdot}-\bar e_{\cdot j}+\bar e_{\cdot\cdot})^2=\sum\sum e_{ij}^2-q\sum\bar e_{i\cdot}^2-p\sum\bar e_{\cdot j}^2+pq\bar e_{\cdot\cdot}^2 gives E(SE)=(pq−p−q+1)σ2=(p−1)(q−1)σ2,E(ME)=σ2.E(S_E)=(pq-p-q+1)\sigma^2=(p-1)(q-1)\sigma^2,\qquad E(M_E)=\sigma^2 .

ANOVA table with expected mean squares.

Source df MS E(MS)
Rows p−1p-1 MAM_A σ2+qp−1∑αi2\sigma^2+\frac q{p-1}\sum\alpha_i^2
Columns q−1q-1 MBM_B σ2+pq−1∑βj2\sigma^2+\frac p{q-1}\sum\beta_j^2
Error (p−1)(q−1)(p-1)(q-1) MEM_E σ2\sigma^2
Total pq−1pq-1

So MA/MEM_A/M_E and MB/MEM_B/M_E are the natural test statistics: each numerator has expectation σ2\sigma^2 exactly when its null hypothesis holds.

Random effects. If the row and column effects are random, αi∼N(0,σα2)\alpha_i\sim N(0,\sigma_\alpha^2) and βj∼N(0,σβ2)\beta_j\sim N(0,\sigma_\beta^2), the same argument gives E(MA)=σ2+qσα2E(M_A)=\sigma^2+q\sigma_\alpha^2, E(MB)=σ2+pσβ2E(M_B)=\sigma^2+p\sigma_\beta^2 and E(ME)=σ2E(M_E)=\sigma^2.

✓ Derivation checked step by step We checked the derivation, and checked by simulation for a 4 × 5 layout that the mean squares average 5.19, 1.90 and 1.00 against the theoretical 5.17, 1.90 and 1.00.

↑ Back to the question list

More on Linear Inference and Multivariate Analysis

Questions: UPSC Civil Services (Main) Examination, Statistics Paper I, 1995–2024. Solutions: Optional Province. Found an error? Tell us.

Spotted an error? Tell us.

We classify every PYQ with care, but mistakes can slip in. If a question is in the wrong topic, has a typo, the wrong year, or is missing, let us know. We review every report and update the page.

Report an Error
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted