predict.BTglmmPQL {BradleyTerry2} | R Documentation |
Predict Method for BTglmmPQL Objects
Description
Obtain predictions and optionally standard errors of those predictions from
a "BTglmmPQL"
object.
Usage
## S3 method for class 'BTglmmPQL'
predict(
object,
newdata = NULL,
newrandom = NULL,
level = ifelse(object$sigma == 0, 0, 1),
type = c("link", "response", "terms"),
se.fit = FALSE,
terms = NULL,
na.action = na.pass,
...
)
Arguments
object |
a fitted object of class |
newdata |
(optional) a data frame in which to look for variables with which to predict. If omitted, the fitted linear predictors are used. |
newrandom |
if |
level |
an integer vector giving the level(s) at which predictions are
required. Level zero corresponds to population-level predictions (fixed
effects only), whilst level one corresponds to the individual-level
predictions (full model) which are NA for contests involving individuals not
in the original data. By default |
type |
the type of prediction required. The default is on the scale of
the linear predictors; the alternative |
se.fit |
logical switch indicating if standard errors are required. |
terms |
with |
na.action |
function determining what should be done with missing
values in |
... |
further arguments passed to or from other methods. |
Details
If newdata
is omitted the predictions are based on the data used for
the fit. In that case how cases with missing values in the original fit are
treated is determined by the na.action
argument of that fit. If
na.action = na.omit
omitted cases will not appear in the residuals,
whereas if na.action = na.exclude
they will appear (in predictions
and standard errors), with residual value NA
. See also
napredict
.
Standard errors for the predictions are approximated assuming the variance of the random effects is known, see Booth and Hobert (1998).
Value
If se.fit = FALSE
, a vector or matrix of predictions. If
se = TRUE
, a list with components
fit |
Predictions |
se.fit |
Estimated standard errors |
Author(s)
Heather Turner
References
Booth, J. G. and Hobert, J. P. (1998). Standard errors of prediction in Generalized Linear Mixed Models. Journal of the American Statistical Association 93(441), 262 – 272.
See Also
Examples
seedsModel <- glmmPQL(cbind(r, n - r) ~ seed + extract,
random = diag(nrow(seeds)),
family = binomial,
data = seeds)
pred <- predict(seedsModel, level = 0)
predTerms <- predict(seedsModel, type = "terms")
all.equal(pred, rowSums(predTerms) + attr(predTerms, "constant"))