Description Usage Arguments Details Value Author(s) See Also Examples
For the current plot, created with Plot3d
, you can use Fit3d
to superimpose
the fitted response surface for one or more models. For example, following
Plot3d( y ~ x + z | g, data)
the fitted surface for a model fit with lm
can be displayed with
Fit3d ( lm( y ~ x*z + I(x^2) + I(z^2) + g, data ))
Other forms are possible, as described under Details.
1 2 3 4 5 | Fit3d(fit, names.vars = pars$names, other.vars = NULL,
grid.lines = 26, col = "blue",
fill = TRUE, grid = TRUE, base.grid = FALSE, col.grid = col, col.res = col,
residuals = FALSE, xlim = c(bbox[1], bbox[2]), zlim = c(bbox[5], bbox[6]),
verbose = 0, type = "response", alpha = 0.5, lit = FALSE, FUN = function(x) x, ...)
|
fit |
A fitted model object (e.g., of class |
names.vars |
|
other.vars |
list of values for variables used in model but not in display |
grid.lines |
Number of grid lines for |
col |
The color used for the grid of fitted values
and other annotations unless specified with other
|
fill |
Draw fitted or function values as a shaded surface? Default: TRUE |
grid |
Draw fitted or function values as a grid with lines? Default: TRUE |
base.grid |
draw grid in base horizontal plane? Default: FALSE |
col.grid |
Color used to draw the grid if |
col.res |
Color used to show residuals if |
residuals |
Show residuals in the plot (i.e., lines from the surface to the points)? |
xlim |
Limits for the |
zlim |
Limits for the |
verbose |
Tell me what you're doing |
type |
For models fit with |
alpha |
Transparency value for the fitted surface |
lit |
rgl lighting. See ... |
FUN |
The response for a model can be a transformation of the scale of the
plot. The
|
... |
Other arguments passed down |
Details: TBW
No useful value, unless verbose=TRUE
, in which case summary(fit)
is returned.
Georges Monette
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ## Not run:
library(car)
data(Prestige)
Prestige$inc <- Prestige$income / 1000
open3d()
Plot3d ( inc ~ women + education|type , Prestige)
Fit3d ( lm(inc ~ women + education,Prestige))
Fit3d ( lm(inc ~ women * education,Prestige), col="pink")
## End(Not run)
data(coffee)
# fit marginal and joint models
fit.stress <- lm(Heart ~ Stress, data=coffee)
fit.coffee <- lm(Heart ~ Coffee, data=coffee)
fit.both <- lm(Heart ~ Coffee + Stress, data=coffee)
Init3d(cex=1.2)
Plot3d( Heart ~ Coffee + Stress, coffee,
surface=TRUE, fit="linear", surface.col="lightblue",
grid.lines=10, sphere.size=0.6)
box3d(color="gray")
data.Ell3d(col="lightblue")
# bivariate marginal ellipses
Lines3d( y = 'min', xz = with( coffee, dell( Coffee, Stress)), lwd=2, color="black")
Lines3d( z = 'min', xy = with( coffee, dell( Coffee, Heart)), lwd=2, color="blue")
Lines3d( x = 'min', yz = with( coffee, dell( Heart, Stress)), lwd=2, color="blue")
# fitted marginal regression planes
Fit3d(fit.stress, col="pink")
Fit3d(fit.coffee, col="green")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.