Description
Usage
Arguments
Details
Safe predictions from a generalized linear model
 ## S3 method for class 'glm'
(object, new_data, = ("link", "conf_int",
"response", "class", "prob"), , std_error = , level = 0.95,
threshold = 0.5)

object 
A glm object returned from a call to stats::glm() .

new_data 
TODO

type 
What kind of predictions to return. Which predictions are
available depends on the family of object .
"link" and "conf_int" are available for all families. "link"
produces numeric predictions on the linear predictor scale. "conf_int"
produces numeric predictions on the response scale and corresponding
confidence bounds.

"response" results in a numeric prediction on the response scale
and is available for families:

gaussian

Gamma

inverse.gaussian

poisson

quasipoisson

quasi

"class" results in hard class predictions and is only available for
binomial and quasibinomial families

"prob" results in class predictions for each class and is only
available for binomial and quasibinomial families
Default is "link" .

... 
Unused. safe_predict() checks that all arguments in ... are
evaluated via the ellipsis package. The idea is to prevent silent errors
when arguments are mispelled. This feature is experimental and feedback
is welcome.

std_error 
Logical indicating whether or not calculate standard
errors for the fit at each point. Not available for all models, and can
be computationally expensive to compute. The standard error is always
the standard error for the mean, and never the standard error for
predictions. Standard errors are returned in a column called .std_error .
Defaults to FALSE .

level 
A number strictly between 0 and 1 to use as the
confidence level when calculating confidence and prediction intervals.
Setting level = 0.90 correspondings to a 90 percent confidence interval.
Ignored except when type = "conf_int" or type = "pred_int" . Defaults
to 0.95 .

threshold 
A number between 0 and 1 to use as a threshold for
classification. When the class probability for the class corresponding
to a positive event is greater than the threshold, the event will be
classified as positive. Defaults to 0.5 .

For GLMs, standard errors can only be calculated when
type = "link"
.
alexpghayes/safepredict documentation built on May 29, 2019, 11:02 p.m.