predict3d: Draw 3d predict plot using package 'rgl'

Description Usage Arguments Examples

Description

Draw 3d predict plot using package 'rgl'

Usage

1
2
3
4
5
6
7
8
predict3d(fit, pred = NULL, modx = NULL, mod2 = NULL, dep = NULL,
  xlab = NULL, ylab = NULL, zlab = NULL, width = 640,
  colorn = 20, maxylev = 6, se = FALSE, show.summary = FALSE,
  overlay = NULL, show.error = FALSE, show.legend = FALSE,
  bg = NULL, type = "s", radius = 2, palette = NULL,
  palette.reverse = TRUE, color = "red", show.subtitle = TRUE,
  show.plane = TRUE, plane.color = "steelblue", plane.alpha = 0.5,
  summarymode = 1, ...)

Arguments

fit

A model object for which prediction is desired.

pred

The name of predictor variable

modx

Optional. The name of moderator variable

mod2

Optional. The name of second moderator variable

dep

Optional. The name of dependent variable

xlab

x-axis label.

ylab

y-axis label.

zlab

z-axis label.

width

the width of device

colorn

An integer giving the desired number of intervals. Non-integer values are rounded down.

maxylev

Maximal length of unique values of y axis variable to be treated as a categorical variable.

se

Logical. Whether or not show se. Only effective when the y-axis variable is a categorical one.

show.summary

Logical. Whether or not show statistical summary

overlay

Logical. Whether or not overlay plots

show.error

Logical. Whether or not show error

show.legend

Logical. Whether or not show legend

bg

Character. Background color of plot

type

For the default method, a single character indicating the type of item to plot. Supported types are: 'p' for points, 's' for spheres, 'l' for lines, 'h' for line segments from z = 0, and 'n' for nothing. For the mesh3d method, one of 'shade', 'wire', or 'dots'. Partial matching is used.

radius

The size of sphere

palette

Name of color palette

palette.reverse

Logical. Whether or not reverse the palette order

color

Default color. Color is used when the palette is NULL

show.subtitle

Logical. If true, show regression call as subtitle

show.plane

Logical. If true, show regression plane

plane.color

Name of color of regression plane

plane.alpha

Transparency scale of regression plane

summarymode

An integer indicating method of extracting typical value of variables. If 1, typical() is used.If 2, mean() is used.

...

additional parameters which will be passed to plot3d

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
fit=lm(mpg~hp*wt,data=mtcars)
predict3d(fit,show.error=TRUE)
fit=lm(log(mpg)~hp*wt,data=mtcars)
predict3d(fit,dep=mpg)

fit=lm(Sepal.Length~Sepal.Width*Species,data=iris)
predict3d(fit,radius=0.05)
require(TH.data)
fit=glm(cens~pnodes*age*horTh,data=GBSG2,family=binomial)
predict3d(fit)
mtcars$engine=ifelse(mtcars$vs==0,"V-shaped","straight")
fit=lm(mpg~wt*engine,data=mtcars)
predict3d(fit,radius=0.5)
fit=loess(mpg~hp*wt,data=mtcars)
predict3d(fit,radius=4)

predict3d documentation built on Sept. 3, 2019, 5:06 p.m.