Create calibration metric for use in calibrate. The function F is the link function described in section 2 of Deville et al. To create a new calibration metric, specify \(F-1\) and its derivative. The package provides cal.linear, cal.raking, cal.logit, which are standard, and cal.sinh from the CALMAR2 macro, for which F is the derivative of the inverse hyperbolic sine.

make.calfun(Fm1, dF, name)

Arguments

Fm1

Function \(F-1\) taking a vector u and a vector of length 2, bounds.

dF

Derivative of Fm1 wrt u: arguments u and bounds

name

Character string to use as name

Value

An object of class "calfun"

References

Deville J-C, Sarndal C-E, Sautory O (1993) Generalized Raking Procedures in Survey Sampling. JASA 88:1013-1020

Deville J-C, Sarndal C-E (1992) Calibration Estimators in Survey Sampling. JASA 87: 376-382

See also

Examples

str(cal.linear)
#> List of 3
#>  $ Fm1 :function (u, bounds)  
#>  $ dF  :function (u, bounds)  
#>  $ name: chr "linear calibration"
#>  - attr(*, "class")= chr "calfun"
cal.linear$Fm1
#> function (u, bounds) 
#> pmin(pmax(u + 1, bounds$lower), bounds$upper) - 1
#> <bytecode: 0x1430cfe88>
#> <environment: namespace:survey>
cal.linear$dF
#> function (u, bounds) 
#> as.numeric(u < bounds$upper - 1 & u > bounds$lower - 1)
#> <bytecode: 0x1430ce9c0>
#> <environment: namespace:survey>

hellinger <- make.calfun(Fm1=function(u, bounds)  ((1-u/2)^-2)-1,
                    dF= function(u, bounds) (1-u/2)^-3 ,
                    name="hellinger distance")

hellinger
#> calibration metric:  hellinger distance 

data(api)
dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)

svymean(~api00,calibrate(dclus1, ~api99, pop=c(6194, 3914069),
         calfun=hellinger))
#>         mean     SE
#> api00 666.79 3.2813

svymean(~api00,calibrate(dclus1, ~api99, pop=c(6194, 3914069),
         calfun=cal.linear))
#>         mean     SE
#> api00 666.72 3.2959

svymean(~api00,calibrate(dclus1, ~api99, pop=c(6194,3914069),
          calfun=cal.raking))
#>         mean    SE
#> api00 666.77 3.286