predict: Predict values using 'oomlm' and 'oomglm' models

Description Usage Arguments See Also Examples

Description

Predict values using oomlm and oomglm models

Usage

1
2
3
4
5
6
7
## S3 method for class 'oomlm'
predict(object, new_data = NULL, std_error = FALSE,
  interval = NULL, level = 0.95, as_function = FALSE, ...)

## S3 method for class 'oomglm'
predict(object, new_data = NULL, type = "response",
  std_error = FALSE, as_function = FALSE, ...)

Arguments

object

An object inheriting from class oomlm.

new_data

Observations for prediction.

std_error

Indicates if the standard error of predicted means should be returned.

interval

Type of interval calculation, "confidence" or "prediction. Is ignored if std_error is FALSE.

level

Confidence level for interval calculation.

as_function

If TRUE, a function requiring only new_data is returned for subsequent fitting.

...

Ignored.

type

The type of prediction for oomglm models, "response" or "link".

See Also

oomlm(), oomglm()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# fit an `oomlm` model
chunks <- oomdata_tbl(mtcars, chunk_size = 1)
x  <- fit(oomlm(mpg ~ cyl + disp + hp), chunks)

# call `predict`
pred <- predict(x, mtcars)
sum((pred - mtcars$mpg)^2)

# pass TRUE for the `as_function` argument and the
# return value will be a prediction function with
# only one argument for data
pred_fun <- predict(x, mtcars, as_function = TRUE)
pred_fun(mtcars[1, ])

# pass TRUE for the `std_error` argument and the
# return value will include standard errors
# for the predicted means
pred <- predict(x, mtcars, std_error = TRUE)
head(pred)

# with std_error true, we can specify that a confidence or
# prediction interval be returned
pred <- predict(x, mtcars, std_error = TRUE, interval = "confidence")
head(pred)

blakeboswell/yotta documentation built on May 30, 2019, 11:43 a.m.