Tidy summarizes information about the components of a model. A model component might be a single term in a regression, a single hypothesis, a cluster, or a class. Exactly what tidy considers to be a model component varies cross models but is usually self-evident. If a model has several distinct types of components, you will need to specify which components to return.

# S3 method for smooth.spline
glance(x, ...)

Arguments

x

A smooth.spline object returned from stats::smooth.spline().

...

Additional arguments. Not used. Needed to match generic signature only. Cautionary note: Misspelled arguments will be absorbed in ..., where they will be ignored. If the misspelled argument has a default value, the default value will be used. For example, if you pass conf.lvel = 0.9, all computation will proceed using conf.level = 0.95. Additionally, if you pass newdata = my_tibble to an augment() method that does not accept a newdata argument, it will use the default value for the data argument.

See also

augment(), stats::smooth.spline()

Other smoothing spline tidiers: augment.smooth.spline

Value

A tibble::tibble() with exactly one row and columns:

crit

minimized criterion

cv.crit

cross-validation score

df

Degrees of freedom used by the model.

lambda

choice of lambda corresponding to `spar`

pen.crit

penalized criterion

spar

smoothing parameter

Examples

spl <- smooth.spline(mtcars$wt, mtcars$mpg, df = 4) augment(spl, mtcars)
#> # A tibble: 32 x 13 #> mpg cyl disp hp drat wt qsec vs am gear carb .fitted #> * <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 22.9 #> 2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 21.1 #> 3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 25.3 #> 4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 19.1 #> 5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 17.8 #> 6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 17.7 #> 7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 17.1 #> 8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 19.2 #> 9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 19.5 #> 10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 17.8 #> # ... with 22 more rows, and 1 more variable: .resid <dbl>
augment(spl) # calls original columns x and y
#> # A tibble: 32 x 5 #> x y w .fitted .resid #> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 2.62 21 1 22.9 -1.87 #> 2 2.88 21 1 21.1 -0.117 #> 3 2.32 22.8 1 25.3 -2.48 #> 4 3.22 21.4 1 19.1 2.33 #> 5 3.44 18.7 1 17.8 0.928 #> 6 3.46 18.1 1 17.7 0.437 #> 7 3.57 14.3 1 17.1 -2.79 #> 8 3.19 24.4 1 19.2 5.19 #> 9 3.15 22.8 1 19.5 3.35 #> 10 3.44 19.2 1 17.8 1.43 #> # ... with 22 more rows
library(ggplot2) ggplot(augment(spl, mtcars), aes(wt, mpg)) + geom_point() + geom_line(aes(y = .fitted))