R/describe_nonlinear.R
describe_nonlinear.Rd
This function summarises the smooth term trend in terms of linear segments. Using the approximative derivative, it separates a nonlinear vector into quasilinear segments (in which the trend is either positive or negative). Each of this segment its characterized by its beginning, end, size (in proportion, relative to the total size) trend (the linear regression coefficient) and linearity (the R2 of the linear regression).
describe_nonlinear(data, ...)
# S3 method for data.frame
describe_nonlinear(data, x = NULL, y = NULL, ...)
estimate_smooth(data, ...)
data  The data containing the link, as for instance obtained by


...  Other arguments to be passed to or from. 
x, y  The name of the responses variable ( 
A dataframe of linear description of nonlinear terms.
library(modelbased)
# Create data
data < data.frame(x = rnorm(200))
data$y < data$x^2 + rnorm(200, 0, 0.5)
model < lm(y ~ poly(x, 2), data = data)
link_data < estimate_relation(model, length = 100)
describe_nonlinear(link_data, x = "x")
#> Start  End  Length  Change  Slope  R2
#> 
#> 2.61  0.06  0.47  6.57  2.58  0.02
#> 0.06  2.76  0.52  7.55  2.68  0.02