Learn R Programming

grt (version 0.1-2)

plot.glc: Plot Method for Class 'glc'

Description

Plot the fitted data set and linear decision boundary.

Usage

## S3 method for class 'glc':
plot(x, fitdb = TRUE, initdb = FALSE, xlim = NULL, ylim = NULL, bg, pch, \dots)

Arguments

x
object of class glc
fitdb
logical. If TRUE, the fitted decision bound is plotted. Default to TRUE
initdb
logical. If TRUE, the decision bound specified by the initial parameters is plotted. Default to FALSE
xlim
the x limits of the plot
ylim
the y limits of the plot
bg
the background color to be used for points. Default is c("white","gray")[response] where response represents the response vector of the model
pch
the symbols to be used as points. Default is c(21,24)[x$category]
...
further arguments.

Details

This function produces a scatter plot of data matrix in the x and (optionally) decision boundary specified within (i.e., x$par and/or x$initpar).

The look of the plot differs depending on the dimension of the model. If the dimension is 1, the model matrix is plotted on the y-axis, and category vector (as in x$category) is plotted on the x axis. If the dimension is 2, scatter plot of the model matrix is plotted. If the dimension is 3, plot3d.glc is called to create a 3D scatter plot. If the dimension is greater than 3, an error message will be returned.

See Also

plot3d.glc

Examples

Run this code
data(subjdemo_2d)
fit.2dl <- glc(response ~ x + y, data=subjdemo_2d, 
    category=subjdemo_2d$category, zlimit=7)
plot(fit.2dl)

#if one wants to plot decision bounds in
# colors different from the defaults
plot(fit.2dl, fitdb=FALSE)
abline(coef=coef(fit.2dl$par), col="orange")
abline(coef=coef(fit.2dl$initpar), col="purple")

Run the code above in your browser using DataLab