Description Usage Arguments Details Value Examples

View source: R/weightconstruction.R

Functions to simplify the construction of non-reponse weights by combining strata with small numbers or large weights.

1 2 3 4 5 6 | ```
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,...)
``` |

`sample.weights` |
table of sampling weight by stratifying variables |

`sample.counts` |
table of sample counts by stratifying variables |

`population` |
table of population size by stratifying variables |

`object` |
object of class |

`count` |
Cells with fewer sampled units than this are "sparse" |

`nrweight` |
Cells with higher non-response weight than this are "sparse" |

`totalweight` |
Cells with average sampling weight times non-response weight higher than this are "sparse" |

`index` |
Number of a cell whose neighbours are to be found |

`a,...` |
Cells to join |

When a stratified survey is conducted with imperfect response it is desirable to rescale the sampling weights to reflect the nonresponse. If some strata have small sample size, high non-response, or already had high sampling weights it may be desirable to get less variable non-response weights by averaging non-response across strata. Suitable strata to collapse may be similar on the stratifying variables and/or on the level of non-response.

`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.

`nonresponse`

and `joinCells`

return objects of class `"nonresponse"`

,
`neighbours`

and `sparseCells`

return objects of class `"nonresponseSubset"`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ```
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)
``` |

survey documentation built on June 23, 2017, 4:41 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.