calib(sampling)
calib()所属R语言包:sampling
g-weights of the calibration estimator
克权重校准估计
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Computes the g-weights of the calibration estimator. The g-weights should lie in the specified bounds for the truncated and logit methods.
计算G-砝码校准估计。 G-权重应该在于截断和logit方法在指定的范围内。
用法----------Usage----------
参数----------Arguments----------
参数:Xs
matrix of calibration variables.
矩阵的标定变量。
参数:d
vector of initial weights.
的初始权重向量。
参数:total
vector of population totals.
向量的人口总数。
参数:q
vector of positive values accounting for heteroscedasticity; the variation of the g-weights is reduced for small values of q.
小Q值降低的正面价值会计的异方差性,变异的g权重向量。
参数:method
calibration method (linear, raking, logit, truncated).
校准方法(线性,耙,对数,截断)。
参数:bounds
vector of bounds for the g-weights used in the truncated and logit methods; 'low' is the smallest value and 'upp' is the largest value.
矢量界为G用权重的截断和logit的方法;“低”是最小值,UPP的是世界上最大的价值。
参数:description
if description=TRUE, summary of initial and final weights are printed, and their boxplots and histograms are drawn; by default, its value is FALSE.
如果描述= TRUE,总结的最初和最终的权重的印刷,箱线图和柱状图绘制,默认情况下,它的值是FALSE。
参数:max_iter
maximum number of iterations in the Newton's method.
牛顿法的迭代的最大数量。
Details
详细信息----------Details----------
The argument method implements the methods given in the paper of Deville and S盲rndal(1992).
的参数方法实现的文件的德维尔及Särndal的(1992)给出的方法。
值----------Value----------
Returns the vector of g-weights.
返回克权重向量。
参考文献----------References----------
Deville, J.-C. and S盲rndal, C.-E. (1992). Calibration estimators in survey sampling. Journal of the American Statistical Association, 87:376–382.<br> Deville, J.-C., S盲rndal, C.-E., and Sautory, O. (1993). Generalized raking procedure in survey sampling. Journal of the American Statistical Association, 88:1013–1020.<br>
参见----------See Also----------
checkcalibration, calibev, gencalib
checkcalibration,calibev,gencalib
实例----------Examples----------
############[###########]
## Example 1[#示例1]
############[###########]
# matrix of sample calibration variables [基质样品的标定变量]
Xs=cbind(
c(1,1,1,1,1,0,0,0,0,0),
c(0,0,0,0,0,1,1,1,1,1),
c(1,2,3,4,5,6,7,8,9,10)
)
# inclusion probabilities[包含概率]
piks=rep(0.2,times=10)
# vector of population totals[向量的人口总数]
total=c(24,26,290)
# the g-weights using the truncated method[克的重量,使用截短的方法]
g=calib(Xs,d=1/piks,total,method="truncated",bounds=c(0.75,1.2))
# the calibration estimator of X is equal to 'total' vector[X的“总”矢量校准估计]
tcal=t(g/piks)%*%Xs
# the g-weights are between lower and upper bounds[克重量的上界和下界之间的]
g
############[###########]
## Example 2[#示例2]
############[###########]
# Example of g-weights (linear, raking, truncated, logit),[示例G-重量(线性,耙,截断,罗吉特),]
# with the data of Belgian municipalities as population.[比利时直辖市人口的数据。]
# Firstly, a sample is selected by means of Poisson sampling.[首先,将样品通过泊松抽样选择。]
# Secondly, the g-weights are calculated.[其次,对于g的权重计算。]
data(belgianmunicipalities)
attach(belgianmunicipalities)
# matrix of calibration variables for the population[人口校准变量矩阵]
X=cbind(
Men03/mean(Men03),
Women03/mean(Women03),
Diffmen,
Diffwom,
TaxableIncome/mean(TaxableIncome),
Totaltaxation/mean(Totaltaxation),
averageincome/mean(averageincome),
medianincome/mean(medianincome))
# selection of a sample with expectation size equal to 200[选择等于200与预期大小的试样]
# by means of Poisson sampling[通过泊松抽样]
# the inclusion probabilities are proportional to the average income [包含概率是成正比的平均收入]
pik=inclusionprobabilities(averageincome,200)
N=length(pik) # population size[人口规模]
s=UPpoisson(pik) # sample[样品]
Xs=X[s==1,] # sample matrix of calibration variables[样品的标定变量矩阵]
piks=pik[s==1] # sample inclusion probabilities[样本包含概率]
n=length(piks) # sample size[样本量]
# vector of population totals of the calibration variables[校准变量矢量的人口总数]
total=c(t(rep(1,times=N))%*%X)
# the population total [人口总数]
total
# computation of the g-weights[的克重量的计算]
# by means of different calibration methods.[通过不同的校准方法。]
g1=calib(Xs,d=1/piks,total,method="linear")
g2=calib(Xs,d=1/piks,total,method="raking")
g3=calib(Xs,d=1/piks,total,method="truncated",bounds=c(0.5,1.5))
g4=calib(Xs,d=1/piks,total,method="logit",bounds=c(0.5,1.5))
# In some cases, the calibration does not exist[在某些情况下,不存在校准]
# particularly when bounds are used.[特别是当使用界限。]
# if the calibration is possible, the calibration estimator of Xs is printed[如果校准是可能的,打印时,X的校准估计]
if(checkcalibration(Xs,d=1/piks,total,g1)$result)
print(c((g1/piks) %*% Xs)) else print("error")
if(!is.null(g2))
if(checkcalibration(Xs,d=1/piks,total,g2)$result)
print(c((g2/piks) %*% Xs)) else print("error")
if(!is.null(g3))
if(checkcalibration(Xs,d=1/piks,total,g3)$result)
print(c((g3/piks) %*% Xs)) else print("error")
if(!is.null(g4))
if(checkcalibration(Xs,d=1/piks,total,g4)$result)
print(c((g4/piks) %*% Xs)) else print("error")
############[###########]
## Example 3[#示例3]
############[###########]
# Example of calibration and adjustment for nonresponse in the 'calibration' vignette[例如校准和调整无应答中的“校准”小插曲]
vignette("calibration", package="sampling")
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|