Plot Method for Class 'glc'

Share:

Description

Plot the fitted data set and linear decision boundary.

Usage

1
2
## S3 method for class 'glc'
plot(x, fitdb = TRUE, initdb = FALSE, xlim = NULL, ylim = NULL, bg, pch, ...)

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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")

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.