regopt: Identify regression beta using different cost functions

Description Usage Arguments Value Author(s) Examples

View source: R/regopt.R

Description

Identify regression beta using different cost functions.

Usage

1
2
regopt(y,X,constant=c(TRUE,FALSE),cost=c("MAE","MdAE","MSE","MdSE","ME","MdE"),
outplot=c(FALSE,TRUE))

Arguments

y

Vector of target data, can be ts object.

X

Matrix of explanatory data, each variable is a column.

constant

If TRUE then a constant is added to the model.

cost

Cost function to use: 1. "MAE" - Mean Absolute Error [Default]; 2. "MdAE" - Median Absolute Error; 3. "MSE" - Mean Squared Error; 4. "MdSE" - Median Squared Error; 5. "ME" - Mean Error; 6. "MdE" - Median Error

outplot

If TRUE plot regression fit.

Value

b

Regression coefficients.

Author(s)

Nikolaos Kourentzes

Examples

1
2
3
4
y <- referrals
X <- c(1:length(y))
X <- as.matrix(X,nrow=length(y),ncol=1)
b <- regopt(y,X,cost="MAE",outplot=TRUE)

trnnick/TStools documentation built on Sept. 14, 2019, 5:22 a.m.