Advertisement
Guest User

Untitled

a guest
Apr 19th, 2015
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. N<-10000
  2. n<-20
  3. dd<-data.frame(x=runif(N))
  4. dd<-transform(dd, y= 4-2*x + rnorm(N))
  5.  
  6. fits<-t(sapply(by(dd, rep(1:(N/n), each=n), function(x) lm(y~x, x)), coef))
  7. head(fits)
  8. # (Intercept) x
  9. # 1 4.025626 -2.3476841
  10. # 2 4.684731 -3.0566627
  11. # 3 4.011690 -1.8731735
  12. # 4 3.788382 -1.9182377
  13. # 5 3.461123 -1.0965173
  14. # 6 3.671282 -0.9247785
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement