Learn R Programming

BalancedSampling (version 2.0.6)

genpopUniform: Generate populations

Description

Generate uniform and poisson cluster process populations

If from and to is used with genpopPoisson together with mirror, the population will be bounded within these values. For the genpopUniform, these numbers represent the minimum and maximum values of the uniform distribution.

Usage

genpopUniform(size, dims = 2L, from = 0, to = 1)

genpopPoisson( parents, children, dims = 2L, from = 0, to = 1, distribution = function(n) rnorm(n, 0, 0.02), mirror = TRUE )

Arguments

size

The size of the population

dims

The number of auxiliary variables

from

A number or a vector of size dims with the minimum values

to

A number or a vector of size dims with the maximum values

parents

The number of parent locations

children

A number or a vector of size parents with the mean number of children to be spawned.

distribution

A function taking a number as a variable, returning the offset from the parent location.

mirror

If TRUE, the population is mirrored to be inside from and to.

Functions

  • genpopPoisson(): Poisson cluster process

Examples

Run this code
if (FALSE) {
set.seed(12345);
x = genpopUniform(120, 2L);
N = nrow(x);
n = 60;
prob = rep(n / N, N);
s = lpm2(prob, x);
b = sb(prob, x, s);
}

if (FALSE) {
set.seed(12345);
x = genpopPoisson(70, 50, 2L);
N = nrow(x);
n = 60;
prob = rep(n / N, N);
s = lpm2(prob, x);
b = sb(prob, x, s);
}

Run the code above in your browser using DataLab