subtractlm: Subtract linear model from a function

View source: R/subtractlm.R

subtractlmR 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)


TestFunctions documentation built on May 29, 2024, 11 a.m.