densprf | R Documentation |
This function estimates the density using a Poisson GLM with natural splines.
densprf(
x,
n.interval = NULL,
df = 5,
knots.mode = TRUE,
type.nclass = c("wand", "scott", "FD"),
addx = FALSE
)
x |
Input data vector. |
n.interval |
Number of intervals (optional). |
df |
Degrees of freedom for the splines. |
knots.mode |
Boolean to determine if quantiles should be used for knots. |
type.nclass |
Method for determining number of classes. |
addx |
Add |
densprf
is a modification of the denspr
function from the siggenes package.
For more details, see the documentation in the siggenes package.
The function densprf(x)
returns a function that, for a given input z
, computes the estimated density evaluated at the position values of z
as a result.
# Set seed for reproducibility
set.seed(123)
# Generate random data
z <- rnorm(1000)
# Apply densprf function
f <- densprf(z)
# Define sequences for evaluation
x1 <- seq(-4, 4, 0.5)
x2 <- seq(-5, 5, 0.1)
# Evaluate the density function at specified points
f1 <- f(x1)
f2 <- f(x2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.