I have the following R objects:
y <- sample(c(0,2,2),1000,replace=T) X <- matrix(runif(2000,0,2),ncol=2,byrow=T)*2 XX = t(X)%*%X XY = as.numeric(t(X)%*%y)