Guest User

Untitled

a guest
Nov 21st, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. formula.mod2 = hazstd ~ f(agc, model = "rw2") +
  2. f(district, model="besag", graph = g, param = c(1,0.01)) +
  3. f(distr.unstruct, model="iid", param = c(1,0.01)) +
  4. edu1 + edu2 + tpr + sex + bmi
  5.  
  6. mod2 = inla(formula.mod2, data = Zambia, control.family = list(initial = 1),
  7. control.inla = list(h = 1e-4),
  8. control.compute = list(dic = TRUE,cpo=TRUE),
  9. verbose = TRUE)
  10.  
  11. names(mod2$summary.random$agc)
  12. summary(mod2$summary.random$agc$"0.5quant")
  13.  
  14. library("ggplot2")
  15.  
  16. mydata <- as.data.frame(mod2$summary.random$agc)
  17.  
  18. ggplot(mydata) +
  19. geom_line(aes(ID, `0.5quant`)) +
  20. geom_line(aes(ID, `0.025quant`), linetype="dashed") +
  21. geom_line(aes(ID, `0.975quant`), linetype="dashed")
Add Comment
Please, Sign In to add comment