Learn R Programming

jmuOutlier (version 2.2)

truncHist: Truncated Histograms

Description

Produces a truncated histogram.

Usage

truncHist(x, xmin = NULL, xmax = NULL, trim = 0.025, main = NULL, xlab = "x", ...)

Arguments

x

Vector of numerical observations.

xmin

Minimum numerical value to be shown in graph.

xmax

Maximum numerical value to be shown in graph.

trim

The fraction (0 to 0.5) of observations to be trimmed from each end of x before the histogram is constructed.

main

An overall title for the histogram.

xlab

A title for the x-axis.

Optional arguments to hist.

Details

truncHist may be useful if data contain some extreme outliers.

See Also

hist

Examples

Run this code
# NOT RUN {
x1 = sort(rnorm(1000)) ;   c( head(x1), tail(x1)) 

x2 = sort(rnorm(1000)) ;   c( head(x2), tail(x2)) 

y1 = sort(rcauchy(1000)) ; c( head(y1), tail(y1)) 

y2 = sort(rcauchy(1000)) ; c( head(y2), tail(y2)) 

par( mfrow=c(2,2) )
truncHist(x1, main="Normal data; first simulation",  xlab="x1")
truncHist(x2, main="Normal data; second simulation", xlab="x2")
truncHist(y1, main="Cauchy data; first simulation",  xlab="y1")
truncHist(y2, main="Cauchy data; second simulation", xlab="y2")
par( mfrow=c(1,1) )
# }

Run the code above in your browser using DataLab