Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. library(car)
  2. library(quantreg)
  3. library(boot)
  4. newdata = Prestige[,c(1:4)]
  5. education.c = scale(newdata$education, center=TRUE, scale=FALSE)
  6. prestige.c = scale(newdata$prestige, center=TRUE, scale=FALSE)
  7. women.c = scale(newdata$women, center=TRUE, scale=FALSE)
  8. new.c.vars = cbind(education.c, prestige.c, women.c)
  9. newdata = cbind(newdata, new.c.vars)
  10. names(newdata)[5:7] = c("education.c", "prestige.c", "women.c" )
  11. mod1 = lm(income ~ education.c + prestige.c + women.c, data=newdata)
  12. mod2 = rq(income ~ education.c + prestige.c + women.c, data=newdata)
  13.  
  14. mod1.boot <- Boot(mod1, R=999)
  15. boot.ci(mod1.boot, level = .95, type = "all")
  16. dat2 <- newdata[5:7]
  17. mod2.boot <- boot.rq(cbind(1,dat2),newdata$income,tau=0.5, R=10000)
  18. boot.ci(mod2.boot, level = .95, type = "all")
  19. Error in if (ncol(boot.out$t) < max(index)) { :
  20. argument is of length zero
  21.  
  22. t(apply(mod2.boot$B, 2, quantile, c(0.025,0.975)))
  23.  
  24. Warning message:
  25. In sqrt(tv[, 2L]) : NaNs produced
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement