How to generate distribution in R, members of which are inside bounds and mean with SD are fixed?
I just need a distribution which will fit in the supported criteria. This will be used for simulating results from other study for comparison with data I have.
I need something like this:
rBootstrap<-function(n,mean,sd,lowerBound,upperBound){
...
}
which result of d <- rBootstrap(100,50,10,30,100))
had
min(d)
$\approx$ 30,
max(d)
$\approx$ 100,
mean(d)
$\approx$ 50,
sd(d)
$\approx$ 10.
The best result I had achieved is:
rBootstrap<-function(n,mean,sd,lowerBound,upperBound){
data <- rnorm(n,mean,sd)
return(data)
}
summary(rBootstrap(100,50,10,30,100))
Min. 1st Qu. Median Mean 3rd Qu. Max.
26.18 41.27 47.29 48.43 55.06 71.82
and it is very far from desired. I had tried several others but without success.
Is it possible to do this at all and in R in particular?