mvs: Multivariate Stratification

Description Usage Arguments Details Value Author(s) See Also

View source: R/mvcs.r

Description

Selects a subsample of a data frame where the proportion of points in each class of a set of factor variables in the subset match those of the input data frame.

Usage

1
mvs(data, number, variables, iter = 20)

Arguments

data

The data frame to be subsampled.

number

The number of rows of data to be returned, ie. the sample size.

variables

A vector containing the names of factor variables to be used in the stratification

iter

The number of iterations to try to find the optimal solution.

Details

This function uses a chi square test to select rows of an input data frame, where the proportion of values falling in classes of multiple factors closely matches the propotion in the input data. For example, you may have a large input data set of geographic points with variables describing soil type or land use. This function returns a subset of the data, of chosen size, the proportion of soil types and land uses matches those of the input data.

This function works only on factors for which a proportion of counts in each class can be calculated. For stratification with continuous variables, use mvcs.

Value

A data frame.

Author(s)

Grant Williamson

See Also

mvcs


ozjimbob/ecbtools documentation built on Jan. 18, 2021, 7:39 p.m.