[R] Is there a regression surface demo?

G. Jay Kerns gkerns at ysu.edu
Mon Oct 11 21:49:11 CEST 2010


Dear Josh,

On Mon, Oct 11, 2010 at 3:15 PM, Joshua Wiley <jwiley.psych at gmail.com> wrote:
> Hi All,
>
> Does anyone know of a function to plot a regression surface for two
> predictors?  RSiteSearch()s and findFn()s have not turned up what I
> was looking for.  I was thinking something along the lines of:
> http://mallit.fr.umn.edu/fr5218/reg_refresh/images/fig9.gif
>
> I like the rgl package because showing it from different angles is
> nice for demonstrations.  I started to write my own, but it has some
> issues (non functioning code start below), and I figured before I
> tried to work out the kinks, I would ask for the list's feedback.
>
> Any comments or suggestions (about functions or preferred idioms for
> what I tried below, or...) are greatly appreciated.
>
> Josh
>

[snip]

I haven't tried to debug your code, but wanted to mention that the
Rcmdr:::scatter3d function does 3-d scatterplots (with the rgl
package) and adds a regression surface, one of 4 or 5 different types.
 If nothing else, it might be a good place to start for making your
own.

A person can play around with the different types in the Rcmdr under
the Graphs menu.  Or, from the command line:

library(Rcmdr)
with(rock, scatter3d(area, peri, shape))

I hope that this helps,
Jay



More information about the R-help mailing list