Consider the model \[ E(Y_{ij}) = \alpha_i + \beta_j , i = 1, 2; j = 1, 2. \] Let \(\textbf{Y} = (Y_{11},Y_{12},Y_{21},Y_{22})'\) be the vector of observations and \(\boldsymbol{\theta} = (\alpha_1,\alpha_2,\beta_1,\beta_2)'\) be the vector of parameters. Let \(X\) be the design matrix. Then \(X\) is given by
library(Matrix)
X = matrix(c(1,1,0,0,0,0,1,1,1,0,1,0,0,1,0,1), nrow = 4)
X
## [,1] [,2] [,3] [,4]
## [1,] 1 0 1 0
## [2,] 1 0 0 1
## [3,] 0 1 1 0
## [4,] 0 1 0 1
The \(Z = X'X\) matrix is given by
Z = crossprod(X)
Z
## [,1] [,2] [,3] [,4]
## [1,] 2 0 1 1
## [2,] 0 2 1 1
## [3,] 1 1 2 0
## [4,] 1 1 0 2
Rank of the matrix \(Z\) is
k = rankMatrix(Z)[1]
k
## [1] 3
Hence, \(Z\) is a singular matrix and does not have an inverse. However a \(g\)-inverse of \(Z\), viz. \(G\), is given by
library(MASS)
G=ginv(Z)
G
## [,1] [,2] [,3] [,4]
## [1,] 0.3125 -0.1875 0.0625 0.0625
## [2,] -0.1875 0.3125 0.0625 0.0625
## [3,] 0.0625 0.0625 0.3125 -0.1875
## [4,] 0.0625 0.0625 -0.1875 0.3125
Now, let us check whether \(\alpha_1 + \alpha_2\) is estimable or not. Writing \(\alpha_1 + \alpha_2 = \textbf{l}_1'\boldsymbol{\theta}\), we get \(\textbf{l}_1\) as
l_1=c(1,1,0,0)
as.matrix(l_1)
## [,1]
## [1,] 1
## [2,] 1
## [3,] 0
## [4,] 0
Let us check whether \(\textbf{l}_1 \in \mathcal{R}(Z)\) or not.
k1 = rankMatrix(rbind(Z,l_1))[1]
ifelse(k1 == k, "l_1 belongs to the rowspace of Z", "l_1 does not belong to the rowspace of Z")
## [1] "l_1 does not belong to the rowspace of Z"
Thus \(\textbf{l}_1 \not\in \mathcal{R}(Z)\). Hence, \(\alpha_1 + \alpha_2\) is not estimable.
Now, let us check whether \(\alpha_1 + \beta_1\) is estimable or not. Writing \(\alpha_1 + \beta_1 = \textbf{l}_2'\boldsymbol{\theta}\), we get \(\textbf{l}_2\) as
l_2=c(1,0,1,0)
as.matrix(l_2)
## [,1]
## [1,] 1
## [2,] 0
## [3,] 1
## [4,] 0
Let us check whether \(\textbf{l}_2 \in \mathcal{R}(Z)\) or not.
k2 = rankMatrix(rbind(Z,l_2))[1]
ifelse(k2 == k, "l_2 belongs to the rowspace of Z", "l_2 does not belong to the rowspace of Z")
## [1] "l_2 belongs to the rowspace of Z"
Thus \(\textbf{l}_1 \in \mathcal{R}(Z)\). Hence, \(\alpha_1 + \beta_1\) is estimable.
Now the vector \(\textbf{l}_2'G\) is given by
t(as.matrix(l_2)) %*% G
## [,1] [,2] [,3] [,4]
## [1,] 0.375 -0.125 0.375 -0.125
Hence, the BLUE of \(\alpha_1 + \beta_1\) is \(0.375 Y_1 - 0.125Y_2 + 0.375Y_3 - 0.125Y_4\). The matrix \(\textbf{l}_2'G\textbf{l}_2\) is given by
t(as.matrix(l_2)) %*% G %*% as.matrix(l_2)
## [,1]
## [1,] 0.75
Hence, the varaince of that BLUE is \(0.75\sigma^2\).