Learn R Programming

tileHMM (version 1.0-5)

sampleObs: Sample Observations from Probability Distribution

Description

Draws a sample of given size from a discrete or continuous probability distribution.

Usage

## S3 method for class 'discDist,numeric':
sampleObs(dist, size)
## S3 method for class 'tDist,numeric':
sampleObs(dist, size)

Arguments

dist
Object of class discDist or tDist. The probability distribution to use.
size
Sample size.
...
Additional arguments.

Value

  • Vector of sampled values.

See Also

dist

Examples

Run this code
## sampling from a t distribution
tdist <- new("tDist",mean=0,var=1,df=3)
obs <- sampleObs(tdist,100)

## sampling from a discrete distribution
nucleo <- new("discDist",alpha=c("A","C","G","T"),prob=rep(0.25,times=4))
dna <- sampleObs(nucleo,100)

Run the code above in your browser using DataLab