R/hist.gpd.R

Defines functions `hist.gpd`

`hist.gpd` <-
function( x , xlab, ylab, main, ... ){
	a <- x$coefficients
	a[ 1 ] <- exp( a[ 1 ] )
	u <- x$threshold
	dat <- x$y

	h <- hist(dat, plot = FALSE)
	x <- seq(u, max(h$breaks), length = 100)
	y <- dgpd( x , a[ 1 ] , a[ 2 ], u )

	if ( missing( xlab ) || is.null( xlab ) ) xlab = "Data"
	if ( missing( ylab ) || is.null( ylab ) ) ylab = ""
	if ( missing( main ) || is.null( main ) ) main = "Histogram and density"
	
  breaks <- seq(from=min(dat),to=max(dat),len=nclass.Sturges(dat)+1)
	hist( dat, prob = TRUE, ylim = c(0, max(y)),
		  xlab=xlab, ylab=ylab, main=main, breaks = breaks, ...)
	lines(x, y, col = 4)
	rug(dat)
	invisible()
}

Try the texmex package in your browser

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

texmex documentation built on May 2, 2019, 4:56 p.m.