4
# Checking for NAs in y, beta is assumed not to contain any
5
indexNA <- which(is.na(y))
7
if(length(indexNA) > 0) {
11
# Checking for NAs in x, beta is assumed not to contain any
12
indexNA <- which(is.na(x), arr.ind=TRUE)
14
if(length(indexNA) > 0) {
16
x[indexNA[, 1], ] <- NA
19
x <- matrix(x[ ! is.na(x)], ncol = ncol(x))
23
# Computing the residual.
24
completeX <- cbind(rep(1, nrow(x)), x)
25
predictedSample <- completeX %*% beta
26
residual <- y - predictedSample