svyratio {survey}R Documentation

Ratio estimation


Ratio estimation and estimates of totals based on ratios for complex survey samples. Estimating domain (subpopulation) means can be done more easily with svymean.


## S3 method for class 'survey.design2':
svyratio(numerator=formula, denominator,
   design,separate=FALSE, na.rm=FALSE,formula, covmat=FALSE,...)
## S3 method for class '':
svyratio(numerator=formula, denominator, design,
   na.rm=FALSE,formula, covmat=FALSE,return.replicates=FALSE, ...)
## S3 method for class 'twophase':
svyratio(numerator=formula, denominator, design,
    separate=FALSE, na.rm=FALSE,formula,...)
## S3 method for class 'svyratio':
predict(object, total, se=TRUE,...)
## S3 method for class 'svyratio_separate':
predict(object, total, se=TRUE,...)
## S3 method for class 'svyratio':
## S3 method for class 'svyratio':


numerator,formula formula, expression, or data frame giving numerator variable(s)
denominator formula, expression, or data frame giving denominator variable(s)
design survey design object
object result of svyratio
total vector of population totals for the denominator variables in object, or list of vectors of population stratum totals if separate=TRUE
se Return standard errors?
separate Estimate ratio separately for strata
na.rm Remove missing values?
covmat Compute the full variance-covariance matrix of the ratios
return.replicates Return replicate estimates of ratios
drop Return a vector rather than a matrix
... Other unused arguments for other methods


The separate ratio estimate of a total is the sum of ratio estimates in each stratum. If the stratum totals supplied in the total argument and the strata in the design object both have names these names will be matched. If they do not have names it is important that the sample totals are supplied in the correct order, the same order as shown in the output of summary(design).

When design is a two-phase design, stratification will be on the second phase.


svyratio returns an object of class svyratio. The predict method returns a matrix of population totals and optionally a matrix of standard errors.


Thomas Lumley


Levy and Lemeshow. "Sampling of Populations" (3rd edition). Wiley

See Also


svymean for estimating proportions and domain means

calibrate for estimators related to the separate ratio estimator.



## survey design objects
scddes<-svydesign(data=scd, prob=~1, id=~ambulance, strata=~ESA,
nest=TRUE, fpc=rep(5,6))
scdnofpc<-svydesign(data=scd, prob=~1, id=~ambulance, strata=~ESA,

# convert to BRR replicate weights
scd2brr <- as.svrepdesign(scdnofpc, type="BRR")

# use BRR replicate weights from Levy and Lemeshow
repweights<-2*cbind(c(1,0,1,0,1,0), c(1,0,0,1,0,1), c(0,1,1,0,0,1),
scdrep<-svrepdesign(data=scd, type="BRR", repweights=repweights)

# ratio estimates
svyratio(~alive, ~arrests, design=scddes)
svyratio(~alive, ~arrests, design=scdnofpc)
svyratio(~alive, ~arrests, design=scd2brr)
svyratio(~alive, ~arrests, design=scdrep)

dstrat<-svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat, fpc=~fpc)

## domain means are ratio estimates, but available directly
svyratio(~I(api.stu*(comp.imp=="Yes")), ~as.numeric(comp.imp=="Yes"), dstrat)
svymean(~api.stu, subset(dstrat, comp.imp=="Yes"))

## separate and combined ratio estimates of total
(sep<-svyratio(~api.stu,~enroll, dstrat,separate=TRUE))
(com<-svyratio(~api.stu, ~enroll, dstrat))

stratum.totals<-list(E=1877350, H=1013824, M=920298)

predict(sep, total=stratum.totals)
predict(com, total=sum(unlist(stratum.totals)))

coef(com, drop=FALSE)

[Package survey version 3.18 Index]