1\name{trimWeights}
2\Rdversion{1.1}
3\alias{trimWeights}
4\alias{trimWeights.svyrep.design}
5\alias{trimWeights.survey.design2}
6%- Also NEED an '\alias' for EACH other topic documented here.
7\title{
8Trim sampling weights
9}
10\description{
11Trims very high or very low sampling weights to reduce the influence of outlying observations. In a replicate-weight design object, the replicate weights are also trimmed. The total amount trimmed is divided among the observations that were not trimmed, so that the total weight remains the same.
12}
13\usage{
14trimWeights(design, upper = Inf, lower = -Inf, ...)
15\method{trimWeights}{survey.design2}(design, upper = Inf, lower = -Inf, strict=FALSE,...)
16\method{trimWeights}{svyrep.design}(design, upper = Inf, lower = -Inf,compress=FALSE,...)
17}
18%- maybe also 'usage' for other objects documented here.
19\arguments{
20  \item{design}{
21  A survey design object
22}
23  \item{upper}{
24  Upper bound for weights
25}
26  \item{lower}{
27  Lower bound for weights
28  }
29  \item{strict}{
30    The reapportionment of the `trimmings' from the weights can push
31    other weights over the limits. If \code{trim=TRUE} the function
32    calls itself recursively to prevent this.
33  }
34  \item{compress}{
35    Compress the replicate weights after trimming.
36    }
37  \item{\dots}{
38  Other arguments for future expansion
39}
40}
41
42\value{
43A new survey design object with trimmed weights.
44}
45
46
47%% ~Make other sections like Warning with \section{Warning }{....} ~
48
49\seealso{
50\code{\link{calibrate}} has a \code{trim} option for trimming the
51calibration adjustments.
52}
53\examples{
54data(api)
55dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)
56
57pop.totals<-c(`(Intercept)`=6194, stypeH=755, stypeM=1018,
58api99=3914069)
59dclus1g<-calibrate(dclus1, ~stype+api99, pop.totals)
60
61summary(weights(dclus1g))
62dclus1t<-trimWeights(dclus1g,lower=20, upper=45)
63summary(weights(dclus1t))
64dclus1tt<-trimWeights(dclus1g, lower=20, upper=45,strict=TRUE)
65summary(weights(dclus1tt))
66
67
68svymean(~api99+api00+stype, dclus1g)
69svymean(~api99+api00+stype, dclus1t)
70svymean(~api99+api00+stype, dclus1tt)
71}
72% Add one or more standard keywords, see file 'KEYWORDS' in the
73% R documentation directory.
74\keyword{survey}
75
76