smooth.spline_tidiers {broom}R Documentation

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 class 'smooth.spline'
augment(x, data = x$data, ...)

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

Arguments

x

a smooth.spline object

data

defaults to data used to fit model

...

not used in this method

Details

No tidy method is provided for smooth.spline objects.

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

Examples


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))


[Package broom version 0.4.3 Index]