R/points.SmithWilsonYieldCurve.R

Defines functions points.SmithWilsonYieldCurve

Documented in points.SmithWilsonYieldCurve

#' Plot generic for SmithWilsonYieldCurve objects
#' 
#' @param x An object of class SmithWilsonYieldCurve or a vector of terms to evaluate the curve at
#' @param y Optionally an object of class SmithWilsonYieldCurve
#' @param aspect either "cts" for continously compounded spot rates, or "zero" for ZCB prices
#' @param ... other arguments to pass to the default plot function
#' 
#' @method points SmithWilsonYieldCurve
#' @export
#' 
points.SmithWilsonYieldCurve <- function(x, y, ..., aspect=c("cts", "zero")){
	
	if (missing(y)) 
		terms <- 1:50
	else 
		terms <- y
	
	zeros <- x$P(terms)
	
	switch( match.arg(aspect),
			cts = points( terms, -log(zeros) / terms, ... ),
			zero = points( terms, zeros, ... ),
			stop("Unknown aspect of yield curve to plot")
	)
	
}

Try the SmithWilsonYieldCurve package in your browser

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

SmithWilsonYieldCurve documentation built on May 2, 2019, 2:16 a.m.