GeoStrata: Constructor for 'GeoStrata' objects.

Description Usage Arguments Details Value Note See Also

View source: R/geostrata.R

Description

Constructor for GeoStrata objects.

Usage

1
GeoStrata(geos, n.groups = 2, group.ratios = rep(1, length.out = n.groups))

Arguments

geos

a Geos object.

n.groups

number of groups. At least 2 and at most the number of geos.

group.ratios

(integer vector of length n.groups) vector of ratios of the sizes of each group. By default each group is assumed to have equal ratios. The sum of these numbers also imply the size of a stratum. For example, c(2, 1) implies that group 1 should be 2 times larger than group 2, and the stratum size is 2 + 1 = 3. Note: the ratios do not have to be normalized to have greatest common divisor 1. For example, c(4, 2) implies that the ratio of group sizes is 2:1 but the stratum size is 4 + 2 = 6.

Details

GeoStrata objects are used for (stratified) randomization of geos into groups. The geos are sorted by their 'volume' (definable by the user) and then divided into strata of size n.groups (column 'stratum'). This object has also a column geo.group, which offers the possibility to fix certain geos to certain groups. By default, this column is filled with NAs, indicating that none of the geos are mapped to any groups. The randomization itself is done by the method Randomize.

Any individual geo -> geo.group mappings should be fixed by using the SetGeoGroup<- method on a GeoStrata object.

A stratum number 0 indicates a geo that is excluded from the scheme stratification. Any geo that is mapped to group 0 will have stratum number 0; for example if geo 2 was omitted (geo.groups were NA, 0, NA, NA, NA, ...) with group.ratios c(2, 1), the strata would be assigned as 1, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, ...

Setting group.ratios to some other value than the default 1,1,... enables creating groups that have different sizes. The stratum size is then determined by the sum of the number in group.ratios. For example, group.ratios=c(1, 2) implies a ratio of 1:2. Each stratum has size 3; the 3 geos in this stratum are assigned a random sample with replacement from the set 1,2,2. Similarly, c(3, 1) implies that group 1 will be on average 3 times as large as group 2.

Value

A GeoStrata object that inherits from Geos. There is an extra column stratum that indicates the stratum number to be used in randomization, and column geo.group for fixing the geo-to-group mapping.

Note

The ratios do not have to be normalized to have greatest common divisor 1. For example, c(4, 2) implies that the ratio of group sizes is 2:1 but the stratum size is 4 + 2 = 6.

See Also

Randomize, SetGeoGroup<-.


google/GeoexperimentsResearch documentation built on May 17, 2019, 7:42 a.m.