require(utils)
<!-- %% FIXME: Do something more sensible (non-random data) !! -->
set.seed(129)
n <- 7 ; p <- 2
X <- matrix(rnorm(n * p), n, p) # no intercept!
y <- rnorm(n)
w <- rnorm(n)^2
str(lmw <- lm.wfit(x = X, y = y, w = w))
str(lm. <- lm.fit (x = X, y = y))
if(require("microbenchmark")) {
mb <- microbenchmark(lm(y~X), lm.fit(X,y), .lm.fit(X,y))
print(mb)
boxplot(mb, notch=TRUE)
}
<!-- %% do an example which sets 'tol' and gives a difference! -->
Run the code above in your browser using DataLab