Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Smoking
- Cough Non-Smoker Occasional Regular
- Yes 266 395 80
- No 1037 977 92
- example <- matrix(c(266,395,80,
- 1037,977,92), byrow = T, nrow = 2)
- dimnames(example) = list(
- Cough = c('Yes','No'),
- Smoking = c('Non-Smoker','Occasional','Regular')
- )
- coughs = example['Yes',]
- patients = apply(example,2,sum)
- prop.trend.test(coughs,patients)
- d = tibble::tribble(
- ~cough, ~smoker, ~Weight,
- 1, 1, 266,
- 0, 1, 1037,
- 1, 2, 395,
- 0, 2, 977,
- 1, 3, 80,
- 0, 3, 92
- )
- model = lm(cough ~ smoker, data = d, weight = Weight)
- #See coeffs and ses
- broom::tidy(model)
- test_stat = (0.106)^2/(0.362)^2 #Not the same as book
Add Comment
Please, Sign In to add comment