Learn R Programming

broom (version 0.4.3)

smooth.spline_tidiers: tidying methods for smooth.spline objects

Description

This combines the original data given to smooth.spline with the fit and residuals

Usage

# S3 method for smooth.spline
augment(x, data = x$data, ...)

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

Arguments

x

a smooth.spline object

data

defaults to data used to fit model

...

not used in this method

Value

augment returns the original data with extra columns:

.fitted

Fitted values of model

.resid

Residuals

glance returns one row with columns

spar

smoothing parameter

lambda

choice of lambda corresponding to spar

df

equivalent degrees of freedom

crit

minimized criterion

pen.crit

penalized criterion

cv.crit

cross-validation score

Details

No tidy method is provided for smooth.spline objects.

Examples

Run this code
# NOT RUN {
spl <- smooth.spline(mtcars$wt, mtcars$mpg, df = 4)
head(augment(spl, mtcars))
head(augment(spl))  # calls original columns x and y

library(ggplot2)
ggplot(augment(spl, mtcars), aes(wt, mpg)) +
    geom_point() + geom_line(aes(y = .fitted))

# }

Run the code above in your browser using DataLab