Using the Hmisc plsmo Function for Plotting Nonparametric loess Trend lines

R Clinic 23Oct08

The following examples use a new Titanic passenger and group survival dataset soon to be put on our Datasets page. load('/home/harrelfe/data/teaching/titanic2008.rda') xless(contents(titanic2008)) attach(titanic2008) plsmo(age, survived) plsmo(age, survived, datadensity=TRUE) plsmo(age, survived, group=sex, datadensity=TRUE) table(class.dept) class.dept 1st Class 2nd Class 3rd Class A la Carte Deck Engine 324 285 708 69 66 325 Victualling 431 plsmo(age, survived, group=class.dept, datadensity=TRUE) s <- class.dept %in% levels(class.dept)[1:3] with(subset(titanic2008,s),plsmo(age, survived, group=interaction(sex,factor(class.dept)), datadensity=TRUE)) plsmo(age, survived, group=class.dept, datadensity=TRUE) plsmo(age, survived, group=class.dept, datadensity=TRUE,trim=0) with(subset(titanic2008,s),plsmo(age, survived, group=interaction(sex,factor(class.dept)), datadensity=TRUE, trim=0)) w <- summary(survived ~ age + sex + class.dept) plot(w) plot(w, cex=2) plot(w, cex=2, cex.labels=1) with(subset(titanic2008,s),plsmo(age, survived, group=interaction(sex,factor(class.dept)), datadensity=TRUE, trim=0)) Ecdf(age) Ecdf(age, q=c(1:3)/4) with(subset(titanic2008,s),plsmo(age, survived, group=interaction(sex,factor(class.dept)), datadensity=TRUE, trim=0))

This topic: Main > WebHome > Seminars > RClinic > RGraphicsplsmo
Topic revision: 26 Oct 2008, FrankHarrell
 
This site is powered by FoswikiCopyright © 2013-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Vanderbilt Biostatistics Wiki? Send feedback