log_basis: Logarithmic Basis Function

Description Usage Arguments Details Examples

Description

The logarithmic basis function

Usage

1
2
log_basis(var, ui = c("none", "increasing", "decreasing"),
          remove_intercept = FALSE)

Arguments

var

a numeric_var object

ui

a character describing possible constraints

remove_intercept

a logical indicating if the intercept term shall be removed

Details

log_basis returns a function for the evaluation of the basis functions with corresponding model.matrix and predict methods.

Examples

1
2
3
4
5
6
7
8
  ### set-up basis
  lb <- log_basis(numeric_var("x", support = c(0.1, pi)))

  ### generate data + coefficients
  x <- as.data.frame(mkgrid(lb, n = 100))

  ### 1 + 2 * log(x) 
  max(abs(predict(lb, newdata = x, coef = c(1, 2)) - (1 + 2 * log(x$x))))


Search within the basefun package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.