Generate a sample data set from a mixture of two normal distributions.

Plot the estimated density.

The density estimate shows the bimodality of the sample.

Load the sample data.

Compute and plot the estimated cdf evaluated at a specified set of values.

`ksdensity`

seems to smooth the cumulative distribution function estimate too much. An estimate with a smaller bandwidth might produce a closer estimate to the empirical cumulative distribution function.

Return the bandwidth of the smoothing window.

Plot the cumulative distribution function estimate using a smaller bandwidth.

The `ksdensity`

estimate with a smaller bandwidth matches the empirical cumulative distribution function better.

Load the sample data.

Plot the estimated cdf evaluated at 50 equally spaced points.

Generate sample data from an exponential distribution with mean 3.

Create a logical vector that indicates censoring. Here, observations with lifetimes longer than 10 are censored.

Compute and plot the estimated density function.

Compute and plot the survivor function.

Compute and plot the cumulative hazard function.

Generate a mixture of two normal distributions, and plot the estimated inverse cumulative distribution function at a specified set of probability values.

Generate a mixture of two normal distributions.

Return the bandwidth of the smoothing window for the probability density estimate.

The default bandwidth is optimal for normal densities.

Plot the estimated density.

Plot the density using an increased bandwidth value.

A higher bandwidth further smooths the density estimate, which might mask some characteristics of the distribution.

Now, plot the density using a decreased bandwidth value.

A smaller bandwidth smooths the density estimate less, which exaggerates some characteristics of the sample.