Dear R-users:

I am trying to use the following code to reproduce the figures on page 140
of Prof. Frank Harrell's book 'Regression Modeling Strategies':

rm(list=ls())
options(width=128)
library(Hmisc)
library(Design)

getHdata(counties)
counties$older <- counties$age6574 + counties$age75
label(counties$older) <- '% age >= 65, 1990'
counties$pdensity <- log10(counties$pop.density+1)
label(counties$pdensity) <- 'log 10 of 1992 pop per 1990 miles^2'

dd <- datadist(counties)
options(datadist='dd')

f <- ols(democrat ~ rcs(pdensity,4) + rcs(pop.change,3) + rcs(older,3) +
crime + rcs(college,5)
         + rcs(income,4) + rcs(college,5) %ia% rcs(income,4) + rcs(farm,3) +
rcs(white,5) +
         rcs(turnout,3), data=counties)
f

r <- resid(f)

windows(width=10.67, height=6.60)
par(mfrow=c(3,3))
par(mar=c(4, 4, 2, 2))
plot(f, ylim=c(20,70))



But I have following problems:
1): the last two subfigures are different with those from the book;
2): I have a error reads:
Error in if (units == "") g(label) else if (label == "") g(units) else if
(plotmath &&  :
  missing value where TRUE/FALSE needed
3): I think there should be another subfigure on variable "turnout", but is
missing in book also

I am using most current version of R, Design and Hmisc.

Thanks

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to