supsmu_fit: supsmu_fit

Description Usage Arguments Details Value Examples

View source: R/lines.R

Description

Computes local linear predictions using Friedman's super smoother (Friedman, 1984)

Usage

1
supsmu_fit(x, y, span = NULL, bass = 0)

Arguments

x

A numeric vector corresponding to the independent variable

y

A numeric vector corresponding to the dependent variable

span

The proportion of datapoints to include in the local fit (Optional)

bass

A value between 0 and 10 that controls the smoothness of the predictions (See Details)

Details

If the span argument is specified, then a fixed span is used for each x value to estimate the local linear regression line, and the bass argument is ignored. Otherwise, the span is selected for each point via cross-validation, as in Friedman, 1984. For the variable span algorithm, bass values closer to 10 result in a smoother-looking curve. Note that ties in the x variable are treated as distinct points, which is different from the behavior of stats::supsmu() (this function's method for handling ties is undocumented).

Value

A numeric vector of super smoother predictions for the y variable at each value of the x variable (sorted by the x variable)

Examples

1
2
3
4
5
x=(1:1000)
y=x+rnorm(1000,5,500)
supsmu_fit(x,y,span=0.2)
supsmu_fit(x,y,bass=5)
supsmu_fit(x,y)

nhart985/NonParamLines documentation built on Dec. 22, 2021, 2:09 a.m.