Skip to contents

A wrapper for stats::ppr() for use in nadir::super_learner().

Usage

lnr_ppr(data, formula, weights = NULL, nterms = 3, ...)

Arguments

data

A dataframe to train a learner / learners on.

formula

A regression formula to use inside this learner.

weights

Observation weights; see ?lm

nterms

Number of ridge terms to include in the final model; see ?stats::ppr.

...

Any extra arguments that should be passed to the internal model for model fitting purposes.

Value

A prediction function that accepts newdata, which returns predictions (a numeric vector of values, one for each row of newdata).

Details

Projection pursuit regression models the outcome as a sum of smooth ridge functions of linear combinations of the covariates, \(\hat{y} = \sum_m g_m(\alpha_m^\top x)\). It captures interactions and nonlinearities along learned directions in covariate space, and being part of base R's stats package, adds no new dependencies.

See also

learners

Examples

lnr_ppr(mtcars, mpg ~ hp + disp + wt)(mtcars)
#>  [1] 20.13583 20.86293 23.47571 20.12017 19.47303 19.07941 14.62626 24.68654
#>  [9] 22.59896 18.27670 18.27670 16.18028 17.22302 17.47399 10.51655 10.47636
#> [17] 12.92850 31.01173 31.78831 30.64668 22.80076 15.27471 16.30986 13.89206
#> [25] 18.49387 30.47716 24.53112 28.99165 15.94673 19.57092 15.06377 21.68974
lnr_ppr(mtcars, mpg ~ ., nterms = 4)(mtcars)
#>  [1] 20.87646 20.69794 22.71188 20.88446 18.69651 18.95634 14.18282 24.42807
#>  [9] 22.98255 18.64815 18.04287 16.39126 16.18458 15.34582 10.03314 10.88610
#> [17] 14.05793 31.40507 30.82004 33.76032 21.78565 14.97254 15.89663 14.18532
#> [25] 18.92259 27.73378 26.45850 30.49915 16.16303 20.15555 14.51126 21.62370