Learn R Programming

party (version 1.0-25)

reweight: Re-fitting Models with New Weights

Description

Generic function for re-fitting a model object using the same observations but different weights.

Usage

reweight(object, weights, ...)

Arguments

object
a fitted model object.
weights
a vector of weights.
...
arguments passed to methods.

Value

Details

The method is not unsimilar in spirit to update, but much more narrowly focused. It should return an updated fitted model derived from re-fitting the model on the same observations but using different weights.

See Also

update

Examples

Run this code
  ## fit cars regression
  mf <- dpp(linearModel, dist ~ speed, data = cars)
  fm <- fit(linearModel, mf)
  fm
  
  ## re-fit, excluding the last 4 observations
  ww <- c(rep(1, 46), rep(0, 4))
  reweight(fm, ww)

Run the code above in your browser using DataLab