Learn R Programming

NCSampling (version 1.0)

Alloc: Allocation

Description

Allocate sample among several strata, using proportional allocation. Inputs population file and total sample size. Outputs sample sizes for each stratum

Usage

Alloc(popfile, ntotal)

Arguments

popfile

dataframe containing population data - as a minimum there must be columns named 'PID' (plot identifier), 'Strata' and 'plot_type'.

ntotal

total sample size - required number of reference plots for all strata combined.

Value

A vector of sample sizes, one for each stratum in the population file.

Details

Performs a proportional allocation, by calculating the required sample size for each stratum (i) using the formula n_i = n * N_i / N, where n is the sample size (number of reference plots) and N is the number of target plots.

See Also

Existing and NC.sample.

Examples

Run this code
popfile<-data.frame(PID=1:20, Strata=rep(c('A', 'B'),c(12,8)),
 	plot_type=rep('B',20))
tot.samp<-6
Alloc(popfile, tot.samp)

Run the code above in your browser using DataLab