Description Usage Arguments Value Examples
Construct an xDensity
representation of a kernel smoothing estimator.
1 |
x |
Vector of samples from the underlying distribution. |
n, from, to |
Optional arguments to |
mean, sd |
Optional mean and standard deviation arguments for the extended density. Default to the mean and standard deviation of |
any0 |
Logical; if |
... |
Additional arguments to |
An xDensity
object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # xDensity approximation to a noncentral-t distribution
# true parameters
lambda <- rnorm(1) # noncentrality parameter
nu <- runif(1, 4, 6) # degrees of freedom
# simulate data
x <- rt(1e4, df = nu, ncp = lambda)
# xDensity approximation
xDens <- kernelXD(x)
# true vs approximate PDF
curve(dt(x, df = nu, ncp = lambda),
from = min(x), to = max(x), ylab = "Density")
curve(dXD(x, xDens = xDens), add = TRUE, col = "red")
legend("topleft", legend = c("True PDF", "xDensity Approx."),
fill = c("black", "red"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.