polyap: Polya Sampling from an Urn

Description Usage Arguments Value Examples

View source: R/polyap.R

Description

Consider an urn containing a finite set of values. An item is selected at random from the urn. Then it is returned to the urn along with another item with the same value. Next a value is selected at random from the reconstituted urn and it and a copy our returned to the urn. This process is repeated until k additional items have been added to the original urn. The original composition of the urn along with the selected values, in order, are returned.

Usage

1
polyap(ysamp, k)

Arguments

ysamp

A vector of real numbers which make up the urn.

k

A positive integer which specifies the number of items added to the original composition of the urn.

Value

The returned value is a vector of length equal to the length of ysamp plus k.

Examples

1
polyap(c(0,1),20)

Example output

Loading required package: rcdd
If you want correct answers, use rational arithmetic.
See the Warnings sections added to help pages for
    functions that do computational geometry.

 [1] 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1

polyapost documentation built on Oct. 7, 2021, 5:10 p.m.