approx_with_spline: Approximate spline on data

Description Usage Arguments Value Examples

View source: R/utils-approximations.R

Description

It approximates data with spline function by fitting GAM model.

Usage

1
2
3
4
5
approx_with_spline(effect_data, response, predictor,
  env = parent.frame(), ...)

approx_with_monotonic_spline(effect_data, response, predictor,
  env = parent.frame(), monotonic, ...)

Arguments

effect_data

Black box response data, for example pdp curve.

response

Name of response value from effect_data.

predictor

Name of predictor value from effect_data.

env

Formula environment that should be used for fitting gam model.

...

Other arguments passed to s function.

monotonic

Possible options "up", "down" and "auto. If up the spline is increasing, when down decreasing.

Value

Object of class "gam". See gamObject

Examples

1
2
3
4
5
6
x <- sort(rnorm(20, 5, 5))
y <- rnorm(20, 2, 2)
env <- new.env()
approx_with_spline(data.frame(x = x, y = y), "y", "x", env)

approx_with_monotonic_spline(data.frame(x = x, y = y), "y", "x", env, "up")

krystian8207/xspliner documentation built on Oct. 6, 2019, 11:02 p.m.