nonresponse(sample.weights, sample.counts, population)
sparseCells(object, count=0,totalweight=Inf, nrweight=1.5)
neighbours(index,object)
joinCells(object,a,...)
## S3 method for class 'nonresponse':
weights(object,...)
"nonresponse"
nonresponse
and joinCells
return objects of class "nonresponse"
,
neighbours
and sparseCells
return objects of class "nonresponseSubset"
nonresponse()
combines stratified tables of population size,
sample size, and sample weight into an object. sparseCells
identifies cells that may need combining. neighbours
describes the
cells adjacent to a specified cell, and joinCells
collapses
the specified cells. When the collapsing is complete, use
weights()
to extract the nonresponse weights.data(api)
## pretend the sampling was stratified on three variables
poptable<-xtabs(~sch.wide+comp.imp+stype,data=apipop)
sample.count<-xtabs(~sch.wide+comp.imp+stype,data=apiclus1)
sample.weight<-xtabs(pw~sch.wide+comp.imp+stype, data=apiclus1)
## create a nonresponse object
nr<-nonresponse(sample.weight,sample.count, poptable)
## sparse cells
sparseCells(nr)
## Look at neighbours
neighbours(3,nr)
neighbours(11,nr)
## Collapse some contiguous cells
nr1<-joinCells(nr,3,5,7)
## sparse cells now
sparseCells(nr1)
nr2<-joinCells(nr1,3,11,8)
nr2
## one relatively sparse cell
sparseCells(nr2)
## but nothing suitable to join it to
neighbours(3,nr2)
## extract the weights
weights(nr2)
Run the code above in your browser using DataLab