weights
Extract Model Weights

Description

Extract weights value for fitted model.

Usage

weights(object, ...)
## Default S3 method:
weights(object, ...)
## S3 method for class 'glm':
weights(object, type = c("prior", "working"), ...)

Arguments

object An lm or glm object (the output of the lm() or glm() functions), or a list with a component named weights.
... arguments to be passed to or from future methods. (These are not used by the default or lm methods.)
type character object, specify type of returned weights, must be either "prior", the default, or "working". This is used only by the glm method: the default method returns the prior weights only (there are no "working" weights in least squares regression).
Value
vector of weights value of fitted model.
See Also
glm, lm, naresid
Examples
library(Sdatasets)
wlmfit <- lm(cost ~ age + type + car.age, data=Sdatasets::claims,
    weights=number, na.action=na.exclude)
weights(wlmfit)

glmfit <- glm(cbind(ncases, ncontrols) ~ agegp + C(tobgp, , 1) + C(alcgp, , 1), data = Sdatasets::esoph, family = binomial) weights(glmfit) weights(glmfit, type="working")

Package stats version 6.0.0-69
Package Index