Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- structure(list(protein = c(3.763, 11.27, 3.617, 4.315, 5.834,
- 5.333, 5.728, 7.107, 7.686, 13.189, 6.618, 8.871, 11.653, 10.595,
- 7.232, 6.115, 8.079, 5.208, 4.329, 6.47, 5.121, 10.84, 4.34,
- 9.786, 8.352, 4.196, 5.998, 7.23, 7.385, 6.478, 4.837, 6.389,
- 4.738, 6.902, 4.488, 6.637, 5.637, 4.992, 3.972, 6.312, 4.838,
- 9.912, 6.388, 10.001, 4.179, 5.568, 7.046, 9.254, 5.878, 8.289
- ), sex = structure(c(2L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L,
- 2L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L,
- 2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 2L,
- 2L, 1L, 1L, 1L, 1L, 1L, 1L, 2L), .Label = c("F", "M"), class = "factor"),
- age = c(71, 22, 56, 52, 42, 58, 65, 57, 34, 17, 69, 30, 18,
- 34, 38, 33, 28, 66, 63, 39, 60, 27, 69, 16, 29, 49, 47, 34,
- 26, 65, 60, 78, 62, 27, 71, 22, 63, 62, 71, 42, 54, 20, 45,
- 33, 52, 41, 37, 17, 76, 46), genotype = structure(c(2L, 3L,
- 2L, 2L, 3L, 2L, 1L, 3L, 2L, 1L, 1L, 1L, 3L, 1L, 1L, 2L, 1L,
- 3L, 1L, 2L, 2L, 1L, 2L, 2L, 2L, 1L, 3L, 1L, 1L, 2L, 3L, 3L,
- 3L, 3L, 1L, 2L, 2L, 1L, 2L, 3L, 2L, 1L, 3L, 1L, 1L, 3L, 2L,
- 3L, 3L, 3L), .Label = c("AA", "AC", "CC"), class = "factor")), row.names = c(NA,
- -50L), class = "data.frame")
- fit <- lm(protein~sex+age, data = exam)
- y <- residuals(fit) + coef(fit)[1] # adding the intercept to the residuals
- boxplot(y~exam$genotype) # genotype in this example is my variable of interest.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement