predict.cmp: Model Predictions for a 'glm.cmp' Object

Description Usage Arguments Details Value Examples

View source: R/summarize_extract.R

Description

This is a function for obtaining predictions and optionally estimates standard errors of those prediction from a fitted COM-Poisson regression object.

Usage

1
2
3
4
5
6
7
8
## S3 method for class 'cmp'
predict(
  object,
  newdata = NULL,
  se.fit = FALSE,
  type = c("link", "response"),
  ...
)

Arguments

object

an object class 'cmp', obtained from a call to glm.cmp.

newdata

optionally, a data frame in which to look for variables with which to predict. If omitted, the fitted linear predictors are used.

se.fit

logical; indicating if standard errors are required.

type

the type of prediction required. The default is 'link' which is the scale of the linear predictor i.e., a log scale; the alternative 'response' is on the scale of the response variable. The value of this argument can be abbreviated.

...

other arguments passed to or from other methods (currently unused).

Details

If newdata is omitted the predictions are based on the data used for the fit.

Value

If se.fit = FALSE, a vector of predictions.

If se.fit = TRUE, a list with components

fit

Predictions, as for se.fit = FALSE.

se.fit

Estimated standard errors.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(takeoverbids)
M.bids <- glm.cmp(numbids ~ leglrest + rearest + finrest + whtknght 
    + bidprem + insthold + size + sizesq + regulatn, data=takeoverbids)

predict(M.bids)
predict(M.bids, type= "response")
predict(M.bids, se.fit=TRUE, type="response")

newdataframe <- data.frame(bidprem = 1, finrest = 0, insthold = 0.05,
    leglrest = 0, rearest = 1, regulatn = 0, size = 0.1, whtknght = 1, 
    sizesq = .1^2)
predict(M.bids, se.fit=TRUE, newdata = newdataframe, type="response")

mpcmp documentation built on Oct. 26, 2020, 9:07 a.m.