genpopUniform: Generate populations

View source: R/populations.R

genpopUniformR Documentation

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

## Not run: 
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);

## End(Not run)

## Not run: 
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);

## End(Not run)


BalancedSampling documentation built on May 29, 2024, 10:25 a.m.