How to plot a regression plane with an interaction in rgl

前端 未结 1 1953
礼貌的吻别
礼貌的吻别 2021-01-22 06:21

I want to plot the regression surface from a model with an interaction term using rgl\'s interactive plotting system. It is easy to plot a regression plane for a m

相关标签:
1条回答
  • 2021-01-22 07:06
    grd <- expand.grid(x1=unique(x1), x2=unique(x2) )
    grd$pred <-predict(mod2, newdata=grd)
    persp3d(x=unique(grd[[1]]), y=unique(grd[[2]]), 
                  z=matrix(grd[[3]],5,5), add=TRUE)
    

    enter image description here

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