ctsem (version 3.3.11)

ctDensity: ctDensity

Description

Wrapper for base R density function that removes outliers and computes 'reasonable' bandwidth and x and y limits. Used for ctsem density plots.

Usage

ctDensity(x, bw = "auto", plot = FALSE, ...)

Arguments

x

numeric vector on which to compute density.

bw

either 'auto' or a numeric indicating bandwidth.

plot

logical to indicate whether or not to plot the output.

...

Further args to density.

Examples

Run this code
# NOT RUN {
y <- ctDensity(exp(rnorm(80)))
plot(y$density,xlim=y$xlim,ylim=y$ylim)

#### Compare to base defaults:
par(mfrow=c(1,2))
y=exp(rnorm(10000))
ctdens<-ctDensity(y)
plot(ctdens$density, ylim=ctdens$ylim,xlim=ctdens$xlim)
plot(density(y))
# }

Run the code above in your browser using DataCamp Workspace