model.frame
.model.extract(frame, component)
model.offset(x)
model.response(data, type = "any")
model.weights(x)
"weights"
, "subset"
."any"
, "numeric"
, "double"
.
Using either of latter two coerces the result to have storage mode
"double"
.model.extract
is provided for compatibility with S, which does
not have the more specific functions. It is also useful to extract
e.g. the etastart
and mustart
components of a
glm
fit. model.offset
and model.response
are equivalent to
model.extract(, "offset")
and model.extract(, "response")
respectively. model.offset
sums any terms specified by
offset
terms in the formula or by offset
arguments
in the call producing the model frame: it does check that the offset
is numeric. model.weights
is slightly different from
model.frame(, "weights")
in not naming the vector it returns.model.frame
, offset
a <- model.frame(cbind(ncases,ncontrols) ~ agegp + tobgp + alcgp, data = esoph)
model.extract(a, "response")
stopifnot(model.extract(a, "response") == model.response(a))
a <- model.frame(ncases/(ncases+ncontrols) ~ agegp + tobgp + alcgp,
data = esoph, weights = ncases+ncontrols)
model.response(a)
model.extract(a, "weights")
a <- model.frame(cbind(ncases,ncontrols) ~ agegp,
something = tobgp, data = esoph)
names(a)
stopifnot(model.extract(a, "something") == esoph$tobgp)
Run the code above in your browser using DataLab