data.frame
with the variables.
It is applied to an object which inherits from class "vlm"
(e.g.,
a fitted model of class "vglm"
).model.framevlm(object, setupsmart = TRUE, wrapupsmart = TRUE, ...)
"vglm"
.data
, na.action
,
subset
.
See model.frame
for more information on these.data.frame
containing the variables used in
the object
plus those specified in ...
.object
is
an object which inherits from class "vlm"
(e.g.,
a fitted model of class "vglm"
),
the method will either returned the saved model frame
used when fitting the model (if any, selected by argument
model = TRUE
) or pass the call used when fitting on to the
default method. This code implements smart prediction
(see smartpred
).
model.frame
,
model.matrixvlm
,
predict.vglm
,
smartpred
.# Illustrates smart prediction
pneumo = transform(pneumo, let=log(exposure.time))
fit = vglm(cbind(normal,mild, severe) ~ poly(c(scale(let)), 2),
fam=multinomial,
data=pneumo, trace=TRUE, x=FALSE)
class(fit)
check1 = head(model.frame(fit))
check1
check2 = model.frame(fit, data=head(pneumo))
check2
all.equal(unlist(check1), unlist(check2)) # Should be TRUE
q0 = head(predict(fit))
q1 = head(predict(fit, newdata=pneumo))
q2 = predict(fit, newdata=head(pneumo))
all.equal(q0, q1) # Should be TRUE
all.equal(q1, q2) # Should be TRUE
Run the code above in your browser using DataLab