kott.ratio.Rd
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)
deskott | Object of class |
---|---|
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 |
vartype |
|
conf.int | Boolean ( |
conf.lev | Probability specifying the desired confidence level: the default value is |
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.
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).
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.
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.
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.
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#> mean SE #> income 1256.166 8.681435#> estimate SE #> income/population 1256.166 8.681435