[R] plotting fit from ols( rcs() )

David Winsemius dwinsemius at comcast.net
Sun May 3 01:54:02 CEST 2009


On May 2, 2009, at 4:09 PM, x wrote:

>
> I have: f <- ols( y1 ~ (rcs(x1,3) + rcs(x2,3) + rcs(x1,3) %ia%  
> rcs(x2,3) ) )
>
> Then I do: plot(f)
>
> This plots y1 against x2 for a given value of x1.
>
> Is there a way to make it *also* plot y1 against x1 for a given  
> value of x2?

Are you using the Design/Hmisc packages? If so, then you could get  
informative plots with:

plot(f, x1=NA, x2=NA, method ="contour")  # assuming you have used the  
datadist facilities.

This should give you a two dimension display of what might be called  
iso-levels of y. method= "persp" also works but I find it gives you a  
plot that has shape but not as much quantitative content.

If you want the somewhat more boring plot that you asked for, and  
x2.spec is set as the level of x2 that you specify, then consider:

plot(f, x1=NA, x2=x2.spec)

-- 

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list