sample.ballbin: Generates simulations from the extended balls-in-bins process

Description Usage Arguments Details Value Methods (by generic) Examples

View source: R/sample.ballbin.R

Description

sample.ballbin generates simulated data from the extended balls-in-bins process.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
sample.ballbin(n, size, space, prob, alloc.prob = NULL)

## S3 method for class 'ballbin'
print(x, ...)

## S3 method for class 'ballbin'
plot(
  x,
  ...,
  ball.size = NULL,
  ball.color = NULL,
  ball.colour = ball.color,
  max.plots = 30
)

## S3 method for class 'ballbin'
summary(object, ...)

## S3 method for class 'summary.ballbin'
print(x, ...)

## S3 method for class 'summary.ballbin'
plot(x, ..., bar.color = NULL, bar.colour = bar.color)

Arguments

n

The number of simulations of the process

size

The size parameter for the occupancy distribution (number of balls)

space

The space pararmeter for the occupancy distribution (number of bins)

prob

The probability parameter for the occupancy distribution (probability of ball occupying its bin)

alloc.prob

(Optional) A probability vector for the allocation probabilities for the bins

x, object

ballbin objects (for generics)

...

unused

ball.size, ball.color, ball.colour, max.plots

Set the size, color, and number of plots

bar.color, bar.colour

plotting arguments

Details

This function generates a simulated set of data from the extended balls-in-bins process. The outcome is an object of class ballbin containing the simulations from the process. The output object contains the initial bin-allocation and resulting samples from the process. Calling summary on the simulation object creates a new object of class summary.ballbin containing summary statistics for each sample, including the bin-counts, effective sample-size, occupancy number, max-count number, and hitting times for each possible occupancy number. Each of these objects has a custom printing and plot methods to give user-friendly output.

Value

If all inputs are correctly specified (i.e., parameters are in allowable range) then the output will be a list of class ballbin containing n random samples from the process. If you call summary on this object the output will be another list of class summary.ballbin containing summary statistics for each random sample from the process.

Methods (by generic)

Examples

1
2
3
4
5
d <- sample.ballbin(12, 10, 4, .4)
print(d)
plot(d)
summary(d)
plot(summary(d))

occupancy documentation built on June 24, 2021, 5:06 p.m.