Advertisement
Guest User

Untitled

a guest
Oct 18th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. #### Interaction Plot (Reference Age = 25) (!updated 20171002)
  2.  
  3. ```{r, fig.width = 6, fig.height = 4}
  4. ##!new
  5. ##note to molly: our datadist up until now was called dd
  6. options(prType = NULL, grType = NULL, digits = 3)
  7.  
  8. ddintplot <- datadist(alldata.dt); options(datadist = 'ddintplot')
  9. ddintplot$limits["Adjust to","age"] <- 25
  10.  
  11. f1iAge <- update(f1iAge)
  12.  
  13. f1iAge.log.ggplot <- ggplot(Predict(f1iAge, age, group, ref.zero = TRUE))
  14. f1iAge.exp.ggplot <- ggplot(Predict(f1iAge, age, group, ref.zero = TRUE, fun = exp))
  15.  
  16. ggplot(Predict(f1iAge, age, group, ref.zero = TRUE), ggexpr = TRUE)
  17.  
  18. f1iAge.log.ggplot +
  19. theme_bw() +
  20. labs(title = "Interaction Plot for Model 1",
  21. subtitle = expression(Age %*% Group~Effect),
  22. y = "log Odds",
  23. caption = "Reference: Age - 25, Group - Control")
  24.  
  25. if (FALSE) ggsave("../output/f1iAge.log.ggplot.png", width = 6, height = 4)
  26.  
  27. f1iAge.exp.ggplot +
  28. theme_bw() +
  29. labs(title = "Interaction Plot for Model 1",
  30. subtitle = expression(Age %*% Group~Effect),
  31. y = "Odds Ratio",
  32. caption = "Reference: Age - 25, Group - Control")
  33.  
  34. if (FALSE) ggsave("../output/f1iAge.exp.ggplot.png", width = 6, height = 4)
  35.  
  36. options(prType = 'html', grType = 'plotly', digits = 3)
  37. options(datadist = 'dd')
  38. f1iAge <- update(f1iAge)
  39. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement