|
a |
|
b/partyMod/man/reweight.Rd |
|
|
1 |
\name{reweight} |
|
|
2 |
|
|
|
3 |
\alias{reweight} |
|
|
4 |
\alias{reweight.linearModel} |
|
|
5 |
\alias{reweight.glinearModel} |
|
|
6 |
|
|
|
7 |
\title{Re-fitting Models with New Weights} |
|
|
8 |
|
|
|
9 |
\description{ |
|
|
10 |
Generic function for re-fitting a model object using the same |
|
|
11 |
observations but different weights. |
|
|
12 |
} |
|
|
13 |
|
|
|
14 |
\usage{ |
|
|
15 |
reweight(object, weights, \dots) |
|
|
16 |
} |
|
|
17 |
|
|
|
18 |
\arguments{ |
|
|
19 |
\item{object}{a fitted model object.} |
|
|
20 |
\item{weights}{a vector of weights.} |
|
|
21 |
\item{\dots}{arguments passed to methods.} |
|
|
22 |
} |
|
|
23 |
|
|
|
24 |
\details{ |
|
|
25 |
The method is not unsimilar in spirit to \code{\link[stats]{update}}, but |
|
|
26 |
much more narrowly focused. It should return an updated fitted model |
|
|
27 |
derived from re-fitting the model on the same observations but using |
|
|
28 |
different weights. |
|
|
29 |
} |
|
|
30 |
|
|
|
31 |
\value{The re-weighted fitted model object.} |
|
|
32 |
|
|
|
33 |
\seealso{\code{\link{update}}} |
|
|
34 |
|
|
|
35 |
\examples{ |
|
|
36 |
## fit cars regression |
|
|
37 |
mf <- dpp(linearModel, dist ~ speed, data = cars) |
|
|
38 |
fm <- fit(linearModel, mf) |
|
|
39 |
fm |
|
|
40 |
|
|
|
41 |
## re-fit, excluding the last 4 observations |
|
|
42 |
ww <- c(rep(1, 46), rep(0, 4)) |
|
|
43 |
reweight(fm, ww) |
|
|
44 |
} |
|
|
45 |
|
|
|
46 |
\keyword{regression} |