accessors: Get the results of a stratification

accessorsR Documentation

Get the results of a stratification

Description

These functions return the main results of strata.data, strata.distr and compare_designs, so that the internal structure of the returned objects need not be used.

Usage

boundaries(x, ...)

## S3 method for class 'stratifyR'
boundaries(x, ends = FALSE, ...)

allocation(x, ...)

## S3 method for class 'stratifyR'
allocation(x, ...)

## S3 method for class 'stratifyR'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)

objective(x, ...)

## S3 method for class 'stratifyR'
objective(x, ...)

## S3 method for class 'compare_designs'
objective(x, ...)

variance(x, ...)

## S3 method for class 'stratifyR'
variance(x, ...)

fitted_distribution(x, ...)

## S3 method for class 'stratifyR'
fitted_distribution(x, ...)

## S3 method for class 'compare_designs'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)

Arguments

x

An object of class "stratifyR", or for objective() and as.data.frame() also of class "compare_designs".

...

Not used.

ends

Logical. If TRUE, add the smallest and largest values of the variable to the boundaries. Default FALSE.

row.names, optional

Not used; for compatibility with the generic.

Details

boundaries() returns the optimum strata boundaries (OSB): the L - 1 cut points between the L strata, or, with ends = TRUE, the L + 1 values from the smallest to the largest value of the variable.

allocation() returns one row per stratum, with the lower and upper boundary, the population size N_h, the weight W_h = N_h/N, the standard deviation S_h, the product W_h S_h, the sample size n_h and the sampling fraction f_h = n_h/N_h. as.data.frame() on a "stratifyR" object gives the same table.

objective() returns the value of the objective function \Phi = \sum_h W_h S_h at the boundaries, the quantity that the solvers minimise.

variance() returns the variance of the estimated population mean under the design, with the finite population correction: V = \sum_h W_h^2 S_h^2 (1/n_h - 1/N_h), where a stratum that is sampled completely adds nothing.

fitted_distribution() returns the name of the best-fit distribution and its parameter estimates on the scale of the data.

For a "compare_designs" object, as.data.frame() returns one row per design (SRS, proportional and Neyman allocation), with the variance and standard error of the sample mean and the design effect, and objective() returns \Phi.

Value

boundaries(), objective() and variance() return numeric values, allocation() and as.data.frame() return data frames, and fitted_distribution() returns a list with components distr and estimate.

See Also

strata.data, summary.stratifyR, compare_designs

Examples


data(sugarcane)
res <- strata.data(sugarcane$Production, h = 4, n = 500, method = "exact")
boundaries(res)
allocation(res)
objective(res)
variance(res)
fitted_distribution(res)
as.data.frame(compare_designs(res))


stratifyR documentation built on Nov. 13, 2026, 9:06 a.m.