Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- N<-10000
- n<-20
- dd<-data.frame(x=runif(N))
- dd<-transform(dd, y= 4-2*x + rnorm(N))
- fits<-t(sapply(by(dd, rep(1:(N/n), each=n), function(x) lm(y~x, x)), coef))
- head(fits)
- # (Intercept) x
- # 1 4.025626 -2.3476841
- # 2 4.684731 -3.0566627
- # 3 4.011690 -1.8731735
- # 4 3.788382 -1.9182377
- # 5 3.461123 -1.0965173
- # 6 3.671282 -0.9247785
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement