R: plot partial effects

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

R: plot partial effects

Sebastian Heyneman
Dear All:


I tried to replicate a case study described by Prof. Harrell in Chapter 7 of

his Regression Modeling Strategies book, but failed on using plot to

reproduce partial effects diagram in figure 7.9,  Following is the code:


rm(list=ls())

library(Hmisc)


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

plot(f, ylim = c(20,70))


and the error message reads as:


Error in match.arg(type) :
  'arg' should be one of “ordinary”, “score”, “dfbeta”, “dfbetas”,
“dffit”, “dffits”, “hat”, “hscore”



Does anyone have a clue?


Regards,

Sebastian

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.