Learn R Programming

ClusterBootstrap (version 2.0.0)

predict.clusbootglm: Predict method for cluster bootstrap GLM

Description

Returns the predicted values for an clusbootglm object.

Usage

# S3 method for clusbootglm
predict(
  object,
  stat = mean,
  newdata = NULL,
  interval = FALSE,
  confint.level = NULL,
  keep.bootstrap.matrix = FALSE,
  ...
)

Value

If keep.bootstrap.matrix is FALSE, predict.clusbootglm returns a matrix, containing the predicted values by evaluating the regression parameters in newdata (which defaults to the data value in object). If keep.bootstrap.matrix is TRUE, the function returns a list containing:

predictions

Matrix containing predicted values by evaluating the regression parameters in object$data.

bootstrapmatrix

A n * B matrix with the predictions within all bootstrap samples.

Arguments

object

Object of class clusbootglm.

stat

Center statistic of choice. Defaults to mean.

newdata

Optional data frame in which to look for variables with which to predict. If omitted, observations from the data value of the clusbootglm object are used.

interval

Boolean, indicating whether a confidence interval should be returned.

confint.level

Level of the confidence interval. Should be in [0, 1]. Defaults to .95 when interval = TRUE.

keep.bootstrap.matrix

Boolean, indicating whether the n * B bootstrap matrix should be returned. If TRUE, the return value for predict.clusbootglm becomes a list (see 'Value' below).

...

additional arguments passed to the function defined in the stat parameter.

Author

Mathijs Deen

Examples

Run this code
if (FALSE) {
medication <- medication[medication$time %% 1 == 0,]
medication$time <- as.factor(medication$time)
set.seed(1)
model.1 <- clusbootglm(pos~time*treat, clusterid = id, data = medication)
predict(object = model.1, interval = TRUE)}

Run the code above in your browser using DataLab