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

predict3dR Documentation

Draw 3d predict plot using package 'rgl'

Description

Draw 3d predict plot using package 'rgl'

Usage

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 = NULL,
  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

fit=lm(mpg~hp*wt,data=mtcars)
predict3d(fit,show.error=TRUE)
fit=lm(log(mpg)~hp*wt,data=mtcars)
predict3d(fit,dep=mpg)
## Not run: 
fit=lm(Sepal.Length~Sepal.Width*Species,data=iris)
predict3d(fit)
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)
fit=loess(mpg~hp*wt,data=mtcars)
predict3d(fit,radius=4)
states<-as.data.frame(state.x77[,c("Murder","Population","Illiteracy","Income","Frost")])
fit=lm(Murder~Population+Illiteracy,data=states)
predict3d(fit)
predict3d(fit,radius=200)
fit=lm(mpg~cyl+hp+am,data=mtcars)
predict3d(fit)

## End(Not run)

predict3d documentation built on May 29, 2024, 4:25 a.m.