Computes the range of the ratios between calibrated weights and initial weights (g-weights).

g.range(cal.design)

Arguments

cal.design

Object of class cal.analytic.

Details

This function computes the smallest interval which contains the ratios between calibrated weights and initial weights.

Value

A numeric vector of length 2.

Note

If cal.design has undergone k subsequent calibration steps (with k >= 2), the function will return the range of the ratios between the output weights of calibration steps k and k - 1.

See also

weights to extract the weights from a design object, e.calibrate for calibrating weights and bounds.hint to obtain a hint for calibration problems where range restrictions are imposed on the g-weights.

Examples

# Creation of the object to be calibrated: data(data.examples) des<-e.svydesign(data=example,ids=~towcod+famcod,strata=~SUPERSTRATUM, weights=~weight) # Calibration (partitioned solution) on the marginal distribution # of age in 5 classes (age5c) inside provinces (procod) # (totals in pop06p) with bounds=c(0.5, 1.5): descal06p<-e.calibrate(design=des,df.population=pop06p, calmodel=~age5c-1,partition=~procod,calfun="logit", bounds=c(0.5, 1.5),aggregate.stage=2) # Now let's verify the actual range of the obtained g-weights: g.range(descal06p)
#> g.min g.max #> 0.5127826 1.4952734
# which indeed is covered by c(0.5, 1.5), as required. # Now calibrate once again, this time on the joint distribution of sex # and marstat (totals in pop03) with the global solution: descal2<-e.calibrate(design=descal06p,df.population=pop03, calmodel=~marstat:sex-1,calfun="linear",bounds=bounds) # Notice that the print method correctly takes the calibration chain # into account: descal2
#> Calibrated, Stratified 2 - Stage Cluster Sampling Design (with replacement) #> - [55] strata #> - [1307, 2372] clusters #> #> Call: #> 2: e.calibrate(design = descal06p, df.population = pop03, calmodel = ~marstat:sex - #> 1, calfun = "linear", bounds = bounds) #> 1: e.calibrate(design = des, df.population = pop06p, calmodel = ~age5c - #> 1, partition = ~procod, calfun = "logit", bounds = c(0.5, #> 1.5), aggregate.stage = 2)
# The range of the g-weights for the twice calibrated object is: g.range(descal2)
#> g.min g.max #> 0.9737264 1.0006235
#... which is equal to: range(weights(descal2)/weights(descal06p))
#> [1] 0.9737264 1.0006235
#... and must not be confused with: range(weights(descal2)/weights(des))
#> [1] 0.4993099 1.4946480