Skip to contents

Predictions include the effects of the covariates at their values in the data (or in newdata). The fitted trend at the average of the covariates, which the plots show, is the modeled column of as.data.frame.joinpoint().

Usage

# S3 method for class 'joinpoint'
predict(
  object,
  newdata = NULL,
  model = "final",
  scale = c("response", "link"),
  ...
)

Arguments

object

A joinpoint object.

newdata

Optional data frame with the independent variable (and by-variables for multiple cohorts, and covariates of a fit with covariates). Defaults to the fitted data.

model

"final" or a number of joinpoints.

scale

"response" (original scale) or "link" (model scale).

...

Ignored.

Value

A data frame with cohort keys, x and fit. With newdata, one row per row of newdata, in its order; rows whose by-variable values match no fitted cohort get a missing fit.

Examples

tb <- subset(us_mortality, cause == "Tuberculosis")
fit <- joinpoint(tb, year, rate, kmax = 2, ci_method = "parametric")
predict(fit, newdata = data.frame(year = c(1950, 1990)))
#>      x       fit
#> 1 1950 23.159083
#> 2 1990  0.688869