predict.gt {binGroup} | R Documentation |
Predict Method for Group Testing Model Fits
Description
Obtains predictions for individual observations and optionally estimates standard errors of those predictions from objects of class "gt" or "gt.mp" returned by gtreg and gtreg.mp, respectively.
Usage
## S3 method for class 'gt'
predict(object, newdata, type = c("link", "response"),
se.fit = FALSE, conf.level = NULL, na.action = na.pass, ...)
Arguments
object |
a fitted object of class "gt" or "gt.mp". |
newdata |
optionally, a data frame in which to look for variables with which to predict. If omitted, the fitted linear predictors are used. |
type |
the type of prediction required. The option "link" is on the scale of the linear predictors; the alternative "response" is on the scale of the response variable. Thus for the binomial model the "link" predictions are of log-odds (probabilities on logit scale) and type = "response" gives the predicted probabilities. |
se.fit |
logical switch indicating if standard errors are required. |
conf.level |
confidence level of the interval of the predicted values. |
na.action |
function determining what should be done with missing values in newdata. The default is to predict NA. |
... |
currently not used |
Details
If newdata is omitted the predictions are based on the data used for the fit. When newdata is present and contains missing values, how the missing values will be dealt with is determined by the na.action argument. In this case, if na.action = na.omit omitted cases will not appear, whereas if na.action = na.exclude they will appear (in predictions and standard errors), with value NA. See also napredict.
Value
If se = FALSE, a vector or matrix of predictions. If se = TRUE, a list with components
fit |
Predictions |
se.fit |
Estimated standard errors |
lower |
Lower bound of the confidence interval if calculated |
upper |
Upper bound of the confidence interval if calculated |
Author(s)
Boan Zhang
Examples
data(hivsurv)
fit1 <- gtreg(formula = groupres ~ AGE + EDUC., data = hivsurv,
groupn = gnum, sens = 0.9, spec = 0.9, linkf = "logit", method = "V")
pred.data <- data.frame(AGE = c(15, 25, 30), EDUC. = c(1, 3, 2))
predict(object = fit1, newdata = pred.data, type = "link", se.fit = TRUE)
predict(object = fit1, newdata = pred.data, type = "response",
se.fit = TRUE, conf.level = 0.9)
predict(object = fit1, type = "response", se.fit = TRUE, conf.level = 0.9)