[R] Help on plotting a regression plane?

Uwe Ligges ligges at statistik.uni-dortmund.de
Mon Jul 30 09:20:34 CEST 2001


Uwe Ligges wrote:
> 
> Peter Dalgaard BSA wrote:
> >
> > John Williams <jwilliams at business.otago.ac.nz> writes:
> >
> > > I'm a bit embarrassed to ask this, but can anyone tell me (or point me
> > > to a reference) on how to plot a regression plane in R?
> > >
> > > I have a regression model with two independent variables and have
> > > created a nice 3d scatterplot with scatterplot3d (thanks Uwe!) and now
> > > would like to overlay the regression plane (gridded, preferably.)  Ay
> > > pointers would be appreciated.
> >
> > Doesn't look like something to be embarrassed about... (Uwe, you might
> > want to add this to one of the examples).

[SNIP]

> That's a workaround if you only want to plot it once, but surely
> automating it would be nicer. One can also think about drawing
> non-linear planes. Maybe this will become a additional function for the
> package.


There is scatterplot3d_0.3-7 on CRAN now.
scatterplot3d() returns a new function plane3d() now, which is designed
to draw the requested regression plane.

For more details have a look at the help page, particularly at the last
example:

    library(scatterplot3d)
    data(trees)
    s3d <- scatterplot3d(trees, type="h", highlight.3d=TRUE, 
        angle=55, scale.y=0.7, pch=16, main="scatterplot3d - 5")
  # Now adding a regression plane to the "scatterplot3d":
    attach(trees)
    my.lm <- lm(Volume ~ Girth + Height)
    s3d$plane3d(my.lm)


Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list