Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot.polymars

Polymars: multivariate adaptive polynomial spline regression


Description

Produces two and three dimensional plots of the fitted values from a polymars object.

Usage

## S3 method for class 'polymars'
plot(x, predictor1, response, predictor2, xx, add = FALSE, n,
xyz = FALSE, contour.polymars = FALSE, xlim, ylim, intercept, ...)

Arguments

x

polymars object, typically the result of polymars.

predictor1

the index of a predictor that was used when the polymars model was fit. For the two dimensional plots, this variable is plotted along the X-axis.

response

if the model was fitted to multiple response data the response index should be specified.

predictor2

the index of a predictor that was used when the polymars model was fit. For the three dimensional plots, this variable is plotted along the Y-axis. See xyz.

xx

should be a vector of length equal to the number of predictors in the original data set. The values should be in the same order as in the original dataset. By default the function uses the median values of the data that was used to fit the model. Although the values for predictor and predictor2 are not used, they should still be provided as part of xx.

add

should the plot be added to a previously created plot? Works only for two dimensional plots.

n

number of plotting points (2 dimensional plot) or plotting points along each axis (3 dimensional plot). The default is n = 100 for 2 dimensional plots and n = 33 for 3 dimensional plots.

xyz

is the plot being made a 3 dimensional plot? If there is only one response it need not be set, if two numerical values accompany the model in the call they will be understood as two predictors for a 3-d plot. By default a 3-d plot uses the persp function. Categorical predictors cannot be used for 3 dimensional plots.

contour.polymars

if the plot being made a 3 dimensional plot should it be made as a contour plot (TRUE) or a perspective plot (FALSE). function contour is being made.

intercept

Setting intercept equal to FALSE evaluates the object without intercept. The intercept may also be given any numerical value which overrides the fitted coefficient from the object. The default is TRUE.

xlim,ylim

Plotting limits. The function tries to choose intelligent limits itself

...

other options are passed on.

Details

This function produces a 2-d plot of 1 predictor and response of a polymars object at n equally spaced points or a 3-d plot of two predictors and response of a polymars object. The range of the plot is by default equal to the range of the particular predictor(s) in the original data, but this can be changed by xlim = c(from, to) and ylim = c(from, to).

Author(s)

Martin O'Connor.

References

Charles Kooperberg, Smarajit Bose, and Charles J. Stone (1997). Polychotomous regression. Journal of the American Statistical Association, 92, 117–127.

Charles J. Stone, Mark Hansen, Charles Kooperberg, and Young K. Truong. The use of polynomial splines and their tensor products in extended linear modeling (with discussion) (1997). Annals of Statistics, 25, 1371–1470.

See Also

Examples

data(state)
state.pm <- polymars(state.region, state.x77, knots = 15, classify = TRUE, gcv = 1)
plot(state.pm, 3, 4)

polspline

Polynomial Spline Routines

v1.1.19
GPL (>= 2)
Authors
Charles Kooperberg [aut, cre], Cleve Moler [ctb] (LINPACK routines in src), Jack Dongarra [ctb] (LINPACK routines in src)
Initial release
2020-05-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.