Skip to content
Back to formatted view

Raw Message

Message-ID: <CAD7vWdXA4ib-JdntRaMuvBk-wW=Br9tM80wLG+vY+QG5cm5+7A@mail.gmail.com>
Date: 2019-01-22T02:56:17Z
From: Sebastian Heyneman
Subject: R: plot partial effects

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]]