Description Usage Arguments Value Author(s) Examples
Function for generating n random variates with density p. It should be called after ranlip.PrepareHatFunctionAuto() and ranlip.PrepareHatFunction().
1 |
n |
The number of random vectors desired |
dist |
The distribution function p(x) where x is the array of size dim.. |
output |
The output is n random variates with the density p, in a matrix arranged by rows. |
Gleb Beliakov, Daniela L. Calderon, Deakin University
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | dim<-2
left<-c(-2,-2)
right<-c(2,2)
ranlip.Init(dim, left, right);
num <- 10
numfine <- 4
MinLip <- 1
Fn <- function(x,dim){
r<-x[1]*x[1]+x[2]*x[2]
out <- exp(-( (x[1]+0.2)^2+(x[2]+0.1)^2)/1.1 )*(1-exp(-sqrt(r)))
return(out)
}
ranlip.PrepareHatFunctionAuto(num, numfine, MinLip, Fn)
rv<-ranlip.RandomVecN(100, Fn)
plot(rv[,1],rv[,2],cex=0.5)
ranlip.FreeMem()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.