set.seed(0)
# simulation of Gaussian variables (in a not very straight forward way):
distr <- RRrectangular(RMgauss(), approx=FALSE)
z <- RFrdistr(distr, n=if (interactive()) 1000000 else 10)
hist(z, 200, freq=!TRUE)
x <- seq(-10, 10, 0.1)
lines(x, dnorm(x, sd=sqrt(0.5)))
#creation of random variables whose density is proportional
# to the spherical model:
distr <- RRrectangular(RMspheric(), approx=FALSE)
z <- RFrdistr(distr, n=if (interactive()) 1000000 else 10)
hist(z, 200, freq=!TRUE)
x <- seq(-10, 10, 0.01)
lines(x, 4/3*RFcov(RMspheric(), x, spConform=FALSE))
Run the code above in your browser using DataLab