Agriculture Reference
In-Depth Information
Regression analysis is a very common statistical methodology that can be used
for survey data. Linear and generalized linear regression models are particularly
applicable. For this reason, we have applied the maximum likelihood based
methods developed in this section to the problem of fitting regression models to
survey data.
The aim is to show that the results can be dramatically different if the sampling
mechanism is not correctly considered in the estimation process. We have used the
artificial population introduced in Chap. 6 . The R package used in this example is
survey. The following code was used to generate this population.
> library(sampling)
> library(survey)
> n < - 100
> N < - 1000
> set.seed(160964)
> framepop < - data.frame(id ¼ 1:N, xc ¼ runif(N), yc ¼ runif(N))
> yobs < - (exp((framepop$xc-0.5)^2)+exp((framepop$yc-0.5)^2))
> yobs < - 100-((yobs-min(yobs))/(max(yobs-min(yobs))))*100+
+ (rnorm(N)+5)*5
> q1obs < - sample(1:3,N,replace ¼ T)
> q2obs
< - as.numeric(cut(yobs,quantile(yobs,probs
¼
seq(0, 1,
+ 0.2))))
> q2obs[is.na(q2obs)] < -1
> framepop < - cbind(framepop,yobs,q1obs,q2obs)
In this exercise, we have considered various sampling designs and performed the
relative regression analysis. The estimated regression model is
þ ʲ 2 x 2
þ ʲ 4 y 2
y
¼ ʲ 0 þ ʲ 1 x
þ ʲ 3 y
þ ʵ;
ð
12
:
30
Þ
where x and y are the geographical coordinates of the points.
For each plan, in the first output we report the results obtained by considering the
sample nature of the data set (command svyglm), while in the second output we
describe the wrong outcome that is obtained using infinite population methods
(command lm for linear models and glm for generalized linear models).We
first considered SRS, then
ˀ
ps , and lastly stratified sampling with four strata.
> set.seed(160964)
> srs < - srswor(n,N)
> framesrs < - framepop[srs ¼¼ 1,]
> dsrs < - svydesign(id ¼ ~1,data ¼ framesrs,fpc ¼ ~rep(n/N,n))
> esrs < - svyglm(yobs ~ poly(xc,2)+poly(yc,2),dsrs)
> summary(esrs)
Call:
Search WWH ::




Custom Search