regest {sampling} | R Documentation |
The regression estimator
Description
Computes the regression estimator of the population total, using the
design-based approach.
Usage
regest(formula,Tx,weights,pikl,n,sigma=rep(1,length(weights)))
Arguments
formula |
the regression model formula (y~x). |
Tx |
population total of x, the auxiliary variable. |
weights |
vector of the weights; its length is equal to n, the sample size. |
pikl |
the matrix of joint inclusion probabilities for the sample. |
n |
the sample size. |
sigma |
vector of positive values accounting for heteroscedasticity. |
Value
The function returns an object, which is a list containing
the following components:
regest |
the value of the regression estimator. |
coefficients |
a vector of beta coefficients. |
std_error |
the standard error of coefficients. |
t_value |
the t-values associated to the coefficients. |
p_value |
the p-values associated to the coefficients. |
cov_mat |
the covariance matrix of the coefficients. |
weights |
the specified weights. |
y |
the response variable. |
x |
the model matrix. |
See Also
ratioest
,regest_strata
Examples
# uses the MU284 population to draw a systematic sample
data(MU284)
# there are 3 outliers which are deleted from the population
MU281=MU284[MU284$RMT85<=3000,]
attach(MU281)
# computes the inclusion probabilities using the variable P85; sample size 40
pik=inclusionprobabilities(P85,40)
# the joint inclusion probabilities for systematic sampling
pikl=UPsystematicpi2(pik)
# draws a systematic sample of size 40
s=UPsystematic(pik)
# defines the variable of interest
y=RMT85[s==1]
# defines the auxiliary information
x1=CS82[s==1]
x2=SS82[s==1]
# the joint inclusion probabilities for s
pikls=pikl[s==1,s==1]
# the first-order inclusion probabilities for s
piks=pik[s==1]
# computes the regression estimator with the model y~x1+x2-1
r=regest(formula=y~x1+x2-1,Tx=c(sum(CS82),sum(SS82)),weights=1/piks,pikl=pikls,n=40)
# the regression estimator is
r$regest
# the beta coefficients are
r$coefficients
# regression estimator is the same as the calibration estimator
Xs=cbind(x1,x2)
total=c(sum(CS82),sum(SS82))
g1=calib(Xs,d=1/piks,total,method="linear")
checkcalibration(Xs,d=1/piks,total,g1)
calibev(y,Xs,total,pikls,d=1/piks,g1,with=TRUE,EPS=1e-6)
[Package
sampling version 2.1
Index]