Plot Regression Surface

前端 未结 1 1987
误落风尘
误落风尘 2020-12-10 05:11

I am reading a book by Cohen, Cohen, Aiken and West(2003) \"Applied Multiple Regression Correlation Analysis for the Behavioral Sciences\" and have come across a 3d plot of

相关标签:
1条回答
  • 2020-12-10 05:56

    Here's how I would do it (adding a bit of color) with packages 'rms' and 'lattice':

    require(rms)  # also need to have Hmisc installed
    require(lattice)
    ddI <- datadist(DF)
    options(datadist="ddI")
    lininterp <- ols(y ~ x1*x2, data=DF)
     bplot(Predict(lininterp, x1=25:40, x2=45:60), 
           lfun=wireframe,  # bplot passes extra arguments to wireframe
           screen = list(z = -10, x = -50), drape=TRUE)
    

    enter image description here

    And the non-interaction model:

     bplot(Predict(lin.no.int, x1=25:40, x2=45:60), lfun=wireframe, col=2:8, drape=TRUE, 
    screen = list(z = -10, x = -50),
     main="Estimated regression surface with no interaction")
    

    enter image description here

    0 讨论(0)
提交回复
热议问题