Debian Codegraph @

R/stats-loess.R

raw
1 #' @templateVar class loess
2 #' @template title_desc_tidy
3 #'
4 #' @param x A `loess` objects returned by [stats::loess()].
5 #' @template param_data
6 #' @template param_newdata
7 #' @template param_se_fit
8 #' @template param_unused_dots
9 #'
10 #' @template augment_NAs
11 #'
12 #' @evalRd return_augment(".se.fit")
13 #'
14 #' @details Note that `loess` objects by default will not predict on data
15 #' outside of a bounding hypercube defined by the training data unless the
16 #' original `loess` object was fit with
17 #' `control = loess.control(surface = \"direct\"))`. See
18 #' [stats::predict.loess()] for details.
19 #'
20 #' @examples
21 #'
22 #' lo <- loess(
23 #' mpg ~ hp + wt,
24 #' mtcars,
25 #' control = loess.control(surface = "direct")
26 #' )
27 #'
28 #' augment(lo)
29 #'
30 #' # with all columns of original data
31 #' augment(lo, mtcars)
32 #'
33 #' # with a new dataset
34 #' augment(lo, newdata = head(mtcars))
35 #'
36 #' @aliases loess_tidiers
37 #' @export
38 #' @seealso [augment()], [stats::loess()], [stats::predict.loess()]
39 augment.loess <- function(
40 x,
41 data = model.frame(x),
42 newdata = NULL,
43 se_fit = FALSE,
44 ...
45 ) {
46 augment_newdata(x, data, newdata, se_fit, se = se_fit)
47 }