x <- 1 : 10
X <- cbind(x, x^2)
w <- selectedQr(X)
w
with(w, X %*% R) # = scale(X, center=TRUE, scale=FALSE)
Xqr <- w$X
plot(X[, 1], Xqr[, 1])
plot(X[, 1], Xqr[, 2])
cov(X)
cov(Xqr)
X <- cbind(x, x^3, x^4, x^2)
w <- selectedQr(X, not=2:3)
with(w, X %*% R)
Run the code above in your browser using DataLab