Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(rms)
- library(foreign)
- df <- read.dta("https://stats.idre.ucla.edu/stat/data/ologit.dta")
- dd <- datadist(df)
- options(datadist = "dd")
- fit = lrm(apply ~ gpa, data = df, x = T, y = T)
- pred.fitted = round(predict(fit, type = "fitted"), 2)
- head(pred.fitted, 1) # predictions for the first subject
- # y >= somewhat likely 0.5; y >= very likely 0.12
- pred.ind = round(predict(fit, type = "fitted.ind"), 2)
- head(pred.ind, 1) # predictions for the first subject
- # y = unlikely 0.5; y = somewhat likely 0.38; y = very likely 0.12
- latex(fit, file = "") # see equation below
Add Comment
Please, Sign In to add comment