subtractlm {TestFunctions}R Documentation

Subtract linear model from a function

Description

This returns a new function which a linear model has an r-squared of 0.

Usage

subtractlm(func, d, n = d * 100)

Arguments

func

A function

d

Number of input dimensions

n

Number of points to use for the linear model

Value

A new function

Examples

subtractlm(ackley, 2)


  f <- function(x) {
    if (is.matrix(x)) x[,1]^2
    else x[1]^2
  }
  ContourFunctions::cf(f)
  ContourFunctions::cf(subtractlm(f, 2), batchmax=Inf)


[Package TestFunctions version 0.2.1 Index]