pdensity | R Documentation |
Creates a linear (power=1
) or constant (power=0
) density function in a interval
[a, b]
where
a
and b
are sampled from x
. It samples size
elements without replacement and computes
the value of the distribution function.
pdensity(x, size = 3, power = 1, tol = 1e-06)
sample_density(x, size = 3, power = 1, tol = 1e-06)
x |
numeric: range of density with |
size |
numeric: number of elements to be sampled (without replacement) from x |
power |
numeric: constant or linear density function |
tol |
numeric: disallow for density coefficients near zero (default: |
A list with:
a
the minimum of the interval
i
the maximum of the interval
x
the size
sampled values
fx
the distribution function at x
pcoeff
a polynomial (intercept = first value)
qcoeff
indefinite integral of the polynomial (intercept = first value)
pint
result of the integral(pcoeff, c(a,b), 0:2)
pdensity(-5:5)
pdensity(-5:5, power=1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.