It approximates data with spline function by fitting GAM model.

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

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)
#> #> Family: gaussian #> Link function: identity #> #> Formula: #> y ~ s(x) #> #> Estimated degrees of freedom: #> 1 total = 2 #> #> GCV score: 4.577151
approx_with_monotonic_spline(data.frame(x = x, y = y), "y", "x", env, "up")
#> Warning: initial point very close to some inequality constraints
#> Warning: initial parameters very close to inequality constraints
#> #> Family: gaussian #> Link function: identity #> #> Formula: #> y ~ s(x) #> #> Estimated degrees of freedom: #> 1 total = 2 #> #> GCV score: 4.577151