Deprecated: Please use the function rescale_replicates instead.
Rescale replicate factors. The main application of this rescaling is to ensure that all replicate weights are strictly positive.
Note that this rescaling has no impact on variance estimates for totals (or other linear statistics), but variance estimates for nonlinear statistics will be affected by the rescaling.
rescale_reps(x, tau =NULL, min_wgt =0.01, digits =2)
Arguments
x: Either a replicate survey design object, or a numeric matrix of replicate weights.
tau: Either a single positive number, or NULL. This is the rescaling constant τ used in the transformation τw+τ−1, where w is the original weight.
If tau=NULL or is left unspecified, then the argument min_wgt should be used instead, in which case, τ is automatically set to the smallest value needed to rescale the replicate weights such that they are all at least min_wgt.
min_wgt: Should only be used if tau=NULL or tau is left unspecified. Specifies the minimum acceptable value for the rescaled weights, which will be used to automatically determine the value τ used in the transformation τw+τ−1, where w is the original weight. Must be at least zero and must be less than one.
digits: Only used if the argument min_wgt is used. Specifies the number of decimal places to use for choosing tau. Using a smaller number of digits
is useful simply for producing easier-to-read documentation.
Returns
If the input is a numeric matrix, returns the rescaled matrix. If the input is a replicate survey design object, returns an updated replicate survey design object.
For a replicate survey design object, results depend on whether the object has a matrix of replicate factors rather than a matrix of replicate weights (which are the product of replicate factors and sampling weights). If the design object has combined.weights=FALSE, then the replication factors are adjusted. If the design object has combined.weights=TRUE, then the replicate weights are adjusted. It is strongly recommended to only use the rescaling method for replication factors rather than the weights.
For a replicate survey design object, the scale element of the design object will be updated appropriately, and an element tau will also be added. If the input is a matrix instead of a survey design object, the result matrix will have an attribute named tau
which can be retrieved using attr(x, 'tau').
Details
Let A=[a(1)⋯a(b)⋯a(B)] denote the (n×B) matrix of replicate adjustment factors. To eliminate negative adjustment factors, Beaumont and Patak (2012) propose forming a rescaled matrix of nonnegative replicate factors AS by rescaling each adjustment factor ak(b) as follows:
akS,(b)=τak(b)+τ−1
where τ≥1−ak(b)≥1 for all k in {1,…,n} and all b in {1,…,B}.
The value of τ can be set based on the realized adjustment factor matrix A or by choosing τ prior to generating the adjustment factor matrix A so that τ is likely to be large enough to prevent negative adjustment factors.
If the adjustment factors are rescaled in this manner, it is important to adjust the scale factor used in estimating the variance with the bootstrap replicates. For example, for bootstrap replicates, the adjustment factor becomes Bτ2 instead of B1.
Prior to rescaling: vB(T^y)=B1b=1∑B(T^y∗(b)−T^y)2After rescaling: vB(T^y)=Bτ2b=1∑B(T^yS∗(b)−T^y)2
Examples
## Not run:# Example 1: Rescaling a matrix of replicate weights to avoid negative weights rep_wgts <- matrix( c(1.69742746694909,-0.230761178913411,1.53333377634192,0.0495043413294782,1.81820367441039,1.13229198793703,1.62482013925955,1.0866133494029,0.28856654131668,0.581930729719006,0.91827012312825,1.49979905894482,1.26281337410693,1.99327362761477,-0.25608700039304), nrow =3, ncol =5) rescaled_wgts <- rescale_reps(rep_wgts, min_wgt =0.01) print(rep_wgts) print(rescaled_wgts)# Example 2: Rescaling replicate weights with a specified value of 'tau' rescaled_wgts <- rescale_reps(rep_wgts, tau =2) print(rescaled_wgts)# Example 3: Rescaling replicate weights of a survey design object set.seed(2023) library(survey) data('mu284', package ='survey')## First create a bootstrap design object svy_design_object <- svydesign( data = mu284, ids =~ id1 + id2, fpc =~ n1 + n2
) boot_design <- as_gen_boot_design( design = svy_design_object, variance_estimator ="Stratified Multistage SRS", replicates =5, tau =1)## Rescale the weights rescaled_boot_design <- boot_design |> rescale_reps(min_wgt =0.01) boot_wgts <- weights(boot_design,"analysis") rescaled_boot_wgts <- weights(rescaled_boot_design,'analysis') print(boot_wgts) print(rescaled_boot_wgts)## End(Not run)
References
This method was suggested by Fay (1989) for the specific application of creating replicate factors using his generalized replication method. Beaumont and Patak (2012) provided an extended discussion on this rescaling method in the context of rescaling generalized bootstrap replication factors to avoid negative replicate weights.
The notation used in this documentation is taken from Beaumont and Patak (2012).
Beaumont, Jean-François, and Zdenek Patak. 2012. "On the Generalized Bootstrap for Sample Surveys with Special Attention to Poisson Sampling: Generalized Bootstrap for Sample Surveys." International Statistical Review 80 (1): 127–48. https://doi.org/10.1111/j.1751-5823.2011.00166.x.