Skip to content
Prev 268806 / 398502 Next

3D surface plot

On Aug 16, 2011, at 11:07 PM, Eric Heupel wrote:

            
Here's a wireframe approach... which requires that we define a  
variable that holds the ratio C/D, so this is a sort of projection.  
Any case on the C/D value of 1 ( a plane in either 3 or 4 space I  
believe) will be on the CoverD line = 1 on that plot. The equi-ratio  
planes will fan out from the A=0, B=0 axis .... I think.

 > dput(dat)
structure(list(B = c(1L, 1L, 2L, 1L, 1L, 3L, 1L, 2L, 1L, 2L,
2L, 3L, 1L, 1L, 3L, 2L, 2L, 3L, 1L, 3L, 2L, 3L, 2L, 3L, 2L, 3L,
3L), C = c(1L, 1L, 1L, 2L, 1L, 1L, 3L, 1L, 2L, 2L, 1L, 1L, 2L,
3L, 2L, 3L, 2L, 1L, 3L, 3L, 2L, 2L, 3L, 2L, 3L, 3L, 3L), D = c(1L,
2L, 1L, 1L, 3L, 1L, 1L, 2L, 2L, 1L, 3L, 2L, 3L, 2L, 1L, 1L, 2L,
3L, 3L, 1L, 3L, 2L, 2L, 3L, 3L, 2L, 3L), A = c(1, 0.5, 2, 2,
0.333333333, 3, 3, 1, 1, 4, 0.666666667, 1.5, 0.666666667, 1.5,
6, 6, 2, 1, 1, 9, 1.333333333, 3, 3, 2, 2, 4.5, 3), CoverD = c(1,
0.5, 1, 2, 0.333333333333333, 1, 3, 0.5, 1, 2, 0.333333333333333,
0.5, 0.666666666666667, 1.5, 2, 3, 1, 0.333333333333333, 1, 3,
0.666666666666667, 1, 1.5, 0.666666666666667, 1, 1.5, 1)), .Names =  
c("B",
"C", "D", "A", "CoverD"), row.names = c(NA, -27L), class = "data.frame")
 >

 > require(rms)
 > dat$CoverD <- with(dat, C/D)

 > mod <- ols(A~ rcs(B,3)*rcs(CoverD), data=dat)

 > ddd <- datadist(dat)
 > options(datadist="ddd")
 > ddd <- datadist(dat)
 > bplot(Predict(mod, B, CoverD), lfun=wireframe)
David Winsemius, MD
West Hartford, CT