A step distribution is one where the cdf and quantile function are step functions. This includes empirical distributions. stepdst() facilitates the creation of such a distribution by specifying the observations/breakpoints, along with their weights.

stepdst(y, data, weights = 1, ...)





Outcomes to comprise the distribution. Should either evaluate to a vector, or be a name in the specified data.


Data frame, list, or environment containing the outcome name in y. If missing, y will be evaluated in the parent frame.


Weights corresponding to the outcomes in y. Must not be negative, but need not sum to 1. If data is provided, the data will be searched for the name provided in this argument.


Additional arguments, currently not used.


Object to check


A "stepdst" object, which is also a "dst" object. The cdf is a right-continuous step function, and the quantile function is a left-continuous step function.


require(graphics) require(datasets) marg <- stepdst(hp, data = mtcars) plot(marg, "cdf", n = 1001)
K <- function(x) dnorm(x, sd = 25) cond <- stepdst(hp, data = mtcars, weights = K(disp - 150))
#> Error in K(disp - 150): could not find function "K"
plot(cond, "cdf", n = 1001, lty = 2, add = TRUE)
#> Error in plot(cond, "cdf", n = 1001, lty = 2, add = TRUE): object 'cond' not found