View source: R/sampleDistribution.R
sampleDistribution | R Documentation |
Generates random samples from distribution functions/objects
sampleDistribution(dist, nSamples = 10)
dist |
distribution object to sample |
nSamples |
'integer' size of sample |
sampleDistribution
can be used for any distribution object generated by
makeDistribution
or by functions in the distr
package.
It is a wrapper around dist::r
.
a numeric vector containing the sample
Jens Åström
makeDistribution
myDist <- makeDistribution(input = "logNormal", distParams = list("mean" = 1, "sd" = 0.2))
sampleDistribution(dist = myDist, nSamples = 10)
myDist <- makeDistribution(input = "Poisson", distParams = list("lambda" = 3))
sampleDistribution(myDist, 10)
myProbs <- data.frame("est" = c(0.2, 0.23, 0.34, 0.4), "probs" = c(0.1, 0.4, 0.4, 0.1 ))
myDist <- makeDistribution(myProbs)
sampleDistribution(myDist, 10)
codaSamples <- rnorm(10000, mean = 0.87, sd = 0.3)
myDist <- makeDistribution(codaSamples)
mean(sampleDistribution(myDist, 10000))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.