rvSEL | R Documentation |
Simulate random variables from an SEL object.
rvSEL(n, object, nPoints = 1000)
n |
Number of simulated values. |
object |
An SEL object. |
nPoints |
Number of evaluations for the brute force inversion of the expert cdf. |
The inverse of the distribution function is formed by evaluating
the distribution function at nPoints points and interchanging the
role of dependent and independent variable when building an function
interpolating the data (using splinefun
with "monoH.FC"
option). Note that there are also direct ways of inverting a B-spline
function, which however turned out to be less efficient for our purposes.
A numeric vector containing pseudo-random variates from the expert's density.
Bjoern Bornkamp
Bornkamp, B. and Ickstadt, K. (2009). A Note on B-Splines for Semiparametric Elicitation. The American Statistician, 63, 373–377
SEL
, splinefun
## bimodal example
x2 <- c(0.1, 0.2, 0.5, 0.8, 0.9)
y2 <- c(0.2, 0.4, 0.45, 0.85, 0.99)
fit1 <- SEL(x2, y2, Delta=0.05, d = 4, inknts = x2)
fit2 <- SEL(x2, y2, Delta=0.05, d = 15, N = 0)
comparePlot(fit1, fit2, superpose = TRUE)
## sample from SEL object
xxx <- rvSEL(50000, fit1)
hist(xxx, breaks=100, freq=FALSE)
curve(predict(fit1, newdata=x), add=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.