Description Usage Arguments Value Author(s) See Also Examples
a no frills version of lm. designed to return only the coefficients and nothing else. (and potentially some basic stats in a future version)
1 | fast.lm.df(panel, right.hand.side, left.hand.sides)
|
panel |
a dataframe containing the relevant vectors |
right.hand.side |
a string referencing the column containing the observation vector of
length |
left.hand.sides |
a vector of strings referencing the vectors to use as the design
matrix ( |
the length p
coefficient vector.
Whit Armstrong
lm
the standard lm method.
1 2 3 4 5 6 7 8 9 10 11 12 13 | NC <- 10
NR <- 1e5
A <- as.data.frame(asofdate=1:NR,matrix(rnorm(NR*NC),nrow=NR,ncol=NC))
colnames(A) <- letters[1:NC]
flm.time <- system.time(ans <- fast.lm.df(panel=A, right.hand.side="a",left.hand.sides=c("b","c","d","e")))
lm.time <- system.time(lm.ans <- as.vector(lm("a ~ 0 + b + c + d + e",data=A)$coefficients))
cat("all.equal:", all.equal(ans,lm.ans),"\n")
bmark.times <- rbind(flm.time,
lm.time,
lm.time/flm.time)
print(bmark.times)
ans.compare <- cbind(ans,lm.ans)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.