R/plot.lda.ct.R

Defines functions plot.lda.ct

Documented in plot.lda.ct

#'  Plot an lda.ct object
#'
#' Plots the Fisher's linear discriminant functions generated by a call
#' to \code{\link{lda.ct}}.
#'
#' @param x  linear discriminant analysis object produced by \code{\link{lda.ct}}
#' @param ylab,xlab  y- and x-axis labels
#' @param which which of the linear discrminants to plot
#' @param col color vector
#' @param \dots  other arguments passed to \code{\link{matplot}}
#' @return  None; a plot is generated.
#' @author Biplab Paul <paul.biplab497@gmail.com> and Philip Tzvi Reiss <reiss@stat.haifa.ac.il>
#'
#' @seealso  \code{\link{lda.ct}}
#' @examples
#'
#' ## see the example at the end of ?pca.ct
#'
#'
#' @export plot.lda.ct
#' @export
plot.lda.ct <-
function(x, ylab="Discriminants", xlab="Time", which=NULL, col=NULL, ...) {
	fdobj <- x$fdobj
	wich <- if (is.null(which)) 1:ncol(fdobj$coef) else which
	colvec <- if (is.null(col)) wich else col
	grid <- seq(fdobj$basis$range[1], fdobj$basis$range[2], length = 401)
	matplot(grid, scale(eval.fd(grid,fdobj)[,wich],T,F), type='l', lty=1, ylab=ylab, xlab=xlab,
	        col=colvec, ...)
	legend("topleft", legend=paste0("LD", wich), lty=1, col=colvec)
	for (p in x$partition) abline(v=p, lty=2, col="grey")
	abline(h=0,col='grey')
}

Try the ctmva package in your browser

Any scripts or data that you put into this service are public.

ctmva documentation built on July 26, 2023, 5:18 p.m.