# the lrm function can be used for logistic regression # help(lrm) # No help for lrm, use "help.search" # help.search("lrm") # lrm is in the "Design" package, access it with the "library" function library(Design) # Notice the Design need Hmisc to function, so it is also loaded # Now the help for lrm should work # help(lrm) lrm(Diabetes ~ Age + RACE) summary(lrm(Diabetes ~ Age + RACE)) lrm.model <- lrm(Diabetes ~ Age + RACE) names(lrm.model) class(lrm.model) # Run model with interaction between Age and GENDER lrm.model <- lrm(Diabetes ~ Age * GENDER + RACE) lrm.model # Run anova on the results anova(lrm.model) # I cheated and looked at the examples in the help file plot(lrm.model, Age=50:54, GENDER="Male", RACE="White") plot(lrm.model, Age=50:54, GENDER="Male", RACE="Black") plot(lrm.model, Age=50:54, GENDER="Female", RACE="Black") savehistory(file="workshop-2009") # .First and .Last functions will execute automatically when R is started and ended # .First can be used to automatically load libraries and attach data # .Last can be used to save the history file and clean up the data space # Example for ".First" function () { # Examples: # library(Design) # library(Hmisc) # Write time and date when session starts library(utils) timestamp(stamp = date(), prefix = "##------ ", suffix = " ------##", quiet = TRUE) } # Example for ".Last" function () { timestamp(stamp = date(), prefix = "##------ ", suffix = " ------##", quiet = TRUE) if(interactive()) try(savehistory(".Rhistory")) } # THE END!