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

Description Usage Arguments Examples

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/jrPred documentation built on May 6, 2019, 7:17 a.m.