View source: R/renewal_methods.R
| predict.renewal | R Documentation | 
Compute predictions from renewal objects.
## S3 method for class 'renewal'
predict(
  object,
  newdata = NULL,
  type = c("response", "prob"),
  se.fit = FALSE,
  terms = NULL,
  na.action = na.pass,
  time = 1,
  ...
)
| object | Object of class inheriting from  | 
| newdata | An optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used. | 
| type | type of prediction.  If equal to  | 
| se.fit | A switch indicating if standard errors are required. | 
| terms | If  | 
| na.action | function determining what should be done with missing
values in  | 
| time | TODO | 
| ... | further arguments passed to or from other methods. | 
fn <- system.file("extdata", "McShane_Wei_results_boot.RDS", package = "Countr")
object <- readRDS(fn)
data <- object$data
## old data
predOld.response <- predict(object, type = "response", se.fit = TRUE)
predOld.prob <- predict(object, type = "prob", se.fit = TRUE)
## newData (extracted from old Data)
newData <- head(data)
predNew.response <- predict(object, newdata = newData,
                            type = "response", se.fit = TRUE)
predNew.prob <- predict(object, newdata = newData,
                        type = "prob", se.fit = TRUE)
cbind(head(predOld.response$values),
           head(predOld.response$se$scale),
           head(predOld.response$se$shape),
           predNew.response$values,
           predNew.response$se$scale,
           predNew.response$se$shape)
cbind(head(predOld.prob$values),
      head(predOld.prob$se$scale),
      head(predOld.prob$se$shape),
      predNew.prob$values,
      predNew.prob$se$scale,
      predNew.prob$se$shape)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.