predict.jmdem {jmdem} | R Documentation |
Predict Method for JMDEM Fits
Description
Obtains predictions and optionally estimates standard errors of those predictions from a fitted joint mean and dispersion effect model object.
Usage
## S3 method for class 'jmdem'
predict(object, newdata = NULL, type = c("link", "response"),
se.fit = FALSE, na.action = na.pass, ...)
Arguments
object |
a fitted object of class inheriting from " |
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 default is on the scale of the linear predictors; the alternative " |
se.fit |
logical switch indicating if standard errors are required. |
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 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
.
Value
If se.fit = FALSE
, a vector or matrix of predictions.
If se.fit = TRUE
, a list with components
fit |
Predictions, as for se.fit = FALSE. |
se.fit |
Estimated standard errors. |
Note
Variables are first looked for in newdata
and then searched for in the usual way (which will include the environment of the formula used in the fit). A warning will be given if the variables found are not of the same length as those in newdata
if it was supplied.
Author(s)
Karl Wu Ka Yui (karlwuky@suss.edu.sg)
See Also
Examples
## Example in jmdem(...)
MyData <- simdata.jmdem.sim(mformula = y ~ x, dformula = ~ z,
mfamily = poisson(),
dfamily = Gamma(link = "log"),
beta.true = c(0.5, 4),
lambda.true = c(2.5, 3), n = 100)
fit <- jmdem(mformula = y ~ x, dformula = ~ z, data = MyData,
mfamily = poisson, dfamily = Gamma(link = "log"),
dev.type = "deviance", method = "CG")
## Predict on the scale of the response variable with standard errors.
predict(fit, type = "response", se.fit = TRUE)
## Predict based on a new observation on the scale of the linear
## predictors with standard errors.
predict(fit, newdata = data.frame(x = -1.5, z = 100), se.fit = TRUE)