scatter3d               package:Rcmdr               R Documentation

_T_h_r_e_e-_D_i_m_e_n_s_i_o_n_a_l _S_c_a_t_t_e_r_p_l_o_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     This function uses the 'rgl' package to draw 3D scatterplots with
     various regression surfaces.

_U_s_a_g_e:

     scatter3d(x, y, z, xlab=deparse(substitute(x)), ylab=deparse(substitute(y)),
         zlab=deparse(substitute(z)), revolutions=0, bg.col=c("black", "white"), axis.col=NULL,
         surface.col=c("blue", "green", "orange", "magenta", "cyan", "red", "yellow", "gray"), 
         neg.res.col="red", pos.res.col="green", point.col="yellow",
         text.col=axis.col, grid.col=if (bg.col == "white") "black" else "gray", 
         fogtype=c("exp2", "linear", "exp", "none"), 
         residuals=(length(fit) == 1), surface=TRUE, grid=TRUE, df.smooth=NULL, df.additive=NULL,
         sphere.size=1, threshold=0.01, speed=1, fov=60, 
         fit="linear", groups=NULL, parallel=TRUE, model.summary=FALSE)

_A_r_g_u_m_e_n_t_s:

       x: variable for horizontal axis.

       y: variable for vertical axis (response).

       z: variable for out-of-screen axis.

xlab, ylab, zlab: axis labels.

revolutions: number of full revolutions of the display.

  bg.col: background colour; one of '"white"', '"black"'.

axis.col: colour for axes; default is '"white"' for black background, 
          '"black"' for white background.

surface.col: vector of colours for regression planes,  used in the
          order specified by 'fit'.

neg.res.col, pos.res.col: colours for lines representing negative  and
          positive residuals.

point.col: colour of points.

text.col: colour of axis labels.

grid.col: colour of grid lines on the regression surface(s).

 fogtype: type of fog effect; one of '"exp2"', '"linear"',  '"exp"',
          '"none".'

residuals: plot residuals ('TRUE' or 'FALSE'); available only  when
          there is one surface plotted.

 surface: plot surface(s) ('TRUE' or 'FALSE').

    grid: plot grid lines on the regression surface(s) ('TRUE' or
          'FALSE').

df.smooth: degrees of freedom for the two-dimensional smooth regression
          surface; if 'NULL' (the default), the 'gam' function will
          select the degrees of freedom for a smoothing spline by
          generalized cross-validation; if a positive number, a fixed
          regression spline will be fit with the specified degrees of
          freedom.

df.additive: degrees of freedom for each explanatory variable in an
          additive regression; if 'NULL' (the default), the 'gam'
          function will select degrees of freedom  for the smoothing
          splines by generalized cross-validation; if a positive number
          or a vector of two positive numbers, fixed regression splines
          will be fit with the specified degrees of freedom for each
          term.

sphere.size: relative sizes of spheres representing points;  the actual
          size is dependent on the number of observations.

threshold: if the actual size of the spheres is less than the
          threshold,  points are plotted instead.

   speed: relative speed of revolution of the plot.

     fov: field of view (in degrees); controls degree of perspective.

     fit: one or more of '"linear"', '"quadratic"', '"smooth"', 
          '"additive"'; to display fitted surface(s); partial matching
          is supported -  e.g., 'c("lin", "quad")'.

  groups: if 'NULL' (the default), no groups are defined; if a factor,
          a different surface or set of surfaces is plotted for each
          level of the factor; in this event, the colours in 
          'plane.col' are used successively for the points, surfaces,
          and residuals corresponding to each level of the factor.

parallel: when plotting surfaces by 'groups', should the surfaces be
          constrained to be parallel? A logical value, with default
          'TRUE'.

model.summary: print summary or summaries of the model(s) fit  ('TRUE'
          or 'FALSE').

_V_a_l_u_e:

     Does not return a useful value; used for its side-effect of
     creating a 3D scatterplot.

_N_o_t_e:

     You have to install the 'rgl' and 'mgcv' packages to produce 3D
     plots.

_A_u_t_h_o_r(_s):

     John Fox jfox@mcmaster.ca

_S_e_e _A_l_s_o:

     'rgl.open', 'gam'

_E_x_a_m_p_l_e_s:

         ## Not run: 
     data(state)
     State.x77 <- as.data.frame(state.x77)
     with(State.x77, scatter3d(Income, Murder, Illiteracy))
     with(State.x77,  scatter3d(Income, Murder, Illiteracy, fit=c("linear", "quadratic")))
         
     ## End(Not run)

