Learn R Programming

basefun (version 1.1-4)

intercept_basis: Intercept-Only Basis Function

Description

A simple intercept as basis function

Usage

intercept_basis(ui = c("none", "increasing", "decreasing"), negative = FALSE)

Arguments

ui

a character describing possible constraints

negative

a logical indicating negative basis functions

Details

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

Examples

Run this code

  ### set-up basis
  ib <- intercept_basis()

  ### generate data + coefficients
  x <- as.data.frame(mkgrid(ib))

  ### 2 * 1 
  predict(ib, newdata = x, coef = 2)

Run the code above in your browser using DataLab