Returns a data frame from stats::density function

create.density.df(
  samps = NULL,
  zero.bounded = FALSE,
  distribution = NULL,
  n = 1000,
  ...
)

Arguments

samps

a vector of samples from a distribution

zero.bounded

logical: Restrict density distribution to nonnegative values?

distribution

list with elements distn, parama, paramb, e.g. list('norm', 0, 1)

n

number of points at which to estimate density

...

additional arguments, passed on to stats::density

Value

data frame with x and y = dens(x)

Author

David LeBauer

Examples

prior.df <- create.density.df(distribution = list('norm',0,1))
plot(prior.df)
samp.df <- create.density.df(samps = rnorm(100))
lines(samp.df)