plot3d: This is a function for assisting with 3d plots for the...

Description Usage Arguments Examples

View source: R/plot3d.R

Description

This is a function for assisting with 3d plots for the predictive analytics course

Usage

1
2
plot3d(model, xvar, yvar, zvar, phi = 30, theta = 30, points = FALSE,
  ...)

Arguments

model

A model object as returned by the caret::train function

xvar

The variable to be plotted as the x axis

yvar

The variable to be plotted as the y axis

zvar

The response variable being predicted

phi

Angle defining the viewing direction. phi give the colatitude direction. Default 30.

theta

Angles defining the viewing direction. theta gives the azimuthal direction. Default 30.

points

A logical argument if TRUE the resultant plot will also show the observed points around the fitted surface with red points highlighting those for which the model under estimates and blue points for those points which are below the surface. Note this can get messy when there are large numbers of points.

...

Other parameters to be passed to the persp function

Examples

1
2
3
data(advertising)
m = caret::train(Sales~TV + Radio, data = advertising, method = "lm")
plot3d(m,advertising$TV, advertising$Radio, advertising$Sales, points = TRUE)

jr-packages/jrPredictive documentation built on Nov. 23, 2018, 11:31 p.m.