Calculates estimates, standard errors and confidence intervals for ratios between totals in subpopulations.

kott.ratio(deskott, num, den, by = NULL,
           vartype = c("se", "cv", "cvpct", "var"),
           conf.int = FALSE, conf.lev = 0.95)

Arguments

deskott

Object of class kott.design containing the replicated survey data.

num

Formula defining the numerator variables for the ratio estimator.

den

Formula defining the denominator variables for the ratio estimator.

by

Formula specifying the variables that define the "estimation domains". If NULL (the default option) estimates refer to the whole population.

vartype

character vector specifying the desired variability estimators. It is possible to choose one or more of: standard error (the default), coefficient of variation, percent coefficient of variation, or variance.

conf.int

Boolean (logical) value to request confidence intervals for the estimates: the default is FALSE.

conf.lev

Probability specifying the desired confidence level: the default value is 0.95.

Details

This function calculates weighted estimates for ratios between totals of quantitative variables using suitable weights depending on the class of deskott: calibrated weights for class kott.cal.design and direct weights otherwise. Standard errors are calculated using the extended DAGJK method [Kott 99-01].

The mandatory argument num (den) identifies the variables whose totals appear as the numerator (denominator) in the ratio estimator: the corresponding formula must be of the type
num=~num1+…+numk (den=~den1+…+denl). The function calculates estimates for ratios between homologous variables in num and den; if num and den contain a different number of variables the shortest argument will be tacitly recycled. The deskott variables referenced by num (den) must be numeric and must not contain any missing value (NA).

The optional argument by specifies the variables that define the "estimation domains", that is the subpopulations for which the estimates are to be calculated. If by=NULL (the default option), the estimates produced by kottby refer to the whole population. Estimation domains must be defined by a formula: for example the statement by=~B1:B2 selects as estimation domains the subpopulations determined by crossing the modalities of variables B1 and B2. The deskott variables referenced by by (if any) must be factor and must not contain any missing value (NA).

The conf.int argument allows to request the confidence intervals for the estimates. By default conf.int=FALSE, that is the confidence intervals are not provided.

Whenever confidence intervals are requested (i.e. conf.int=TRUE), the desired confidence level can be specified by means of the conf.lev argument. The conf.lev value must represent a probability (0<=conf.lev<=1) and its default is chosen to be 0.95. Given an input kott.design object with nrg random groups, kott.ratio builds the confidence intervals making use of a t distribution with nrg-1 degrees of freedom.

Value

The return value depends on the value of the input parameters. In the most general case, the function returns an object of class list (typically a list made up of data frames).

Warning

It is possible that, in certain subpopulations, the estimate of the total of some den variables turns out to be zero for the original sample in deskott and/or for some of its nrg replicates. In these cases, kott.ratio (i) returns NaN for the estimates and/or for the corresponding standard errors and (ii) prints a warning message.

References

Kott, Phillip S. (1999) "The Extended Delete-A-Group Jackknife". Bulletin of the International Statistical Instititute. 52nd Session. Contributed Papers. Book 2, pp. 167-168.

Kott, Phillip S. (2001) "The Delete-A-Group Jackknife". Journal of Official Statistics, Vol.17, No.4, pp. 521-526.

See also

kottby for estimating totals and means, kott.quantile for estimating quantiles, kott.regcoef for estimating regression coefficients and kottby.user for calculating estimates based on user-defined estimators.

Examples

data(data.examples) # Creation of a kott.design object: kdes<-kottdesign(data=example,ids=~towcod+famcod,strata=~SUPERSTRATUM, weights=~weight,nrg=15) # Estimate of the ratios y1/x1, y2/x2 e y3/x3 by marstat: kott.ratio(kdes,~y1+y2+y3,~x1+x2+x3,by=~marstat)
#> $married #> estimate SE #> y1/x1 6.114354 0.7936343 #> y2/x2 17.623944 2.9664956 #> y3/x3 1.176216 0.3195264 #> #> $unmarried #> estimate SE #> y1/x1 8.008604 1.4310379 #> y2/x2 18.257839 4.0240239 #> y3/x3 1.381470 0.6002231 #> #> $widowed #> estimate SE #> y1/x1 5.787404 1.5839900 #> y2/x2 22.045785 7.6089853 #> y3/x3 0.538605 0.3024991 #>
# Estimate of the ratios z/x1, z/x2 e z/x3 # for the whole population (notice the recycling rule): kott.ratio(kdes,~z,~x1+x2+x3,conf.int=TRUE)
#> estimate SE l.conf(95%) u.conf(95%) #> z/x1 2135.696 212.5221 1679.881 2591.511 #> z/x2 6244.631 793.2891 4543.195 7946.067 #> z/x3 5965.892 1078.8038 3652.087 8279.696
# Estimators of means can be thought as # ratio estimators: kottby(kdes,~income,estimator="mean")
#> mean SE #> income 1256.166 8.681435
kott.ratio(kott.addvars(kdes,population=1),num=~income,den=~population)
#> estimate SE #> income/population 1256.166 8.681435