Package 'XLS'

Title: A Modeling Approach that Optimizes Future Errors in Least Squares
Description: Given the date column as an ascending entry, future errors are included in the sum of squares of error that should be minimized based on the number of steps and weights you determine. Thus, it is prevented that the variables affect each other's coefficients unrealistically.
Authors: Samet Sokel [aut, cre] , Yavuz Acar [aut, rev]
Maintainer: Samet Sokel <[email protected]>
License: GPL (>= 3)
Version: 0.1.0
Built: 2025-03-09 03:11:14 UTC
Source: https://github.com/sametsoekel/extreme-least-squares

Help Index


Fitting an eXtreme Least Squares Model

Description

Almost the same interface as stats::lm. Just includes two parameters more, error_weights and error_ahead_level

Usage

xls.fit(formula, data, error_weights = NULL, error_ahead_level = 4)

Arguments

formula

An object of class "formula": a symbolic description of the model to be fitted.

data

A "data.frame" (with no missing values) object containing the variables in the model.

error_weights

A numeric vector including error weights by order. If NULL, it is created automatically by error_ahead_level amount, decreasing at equal intervals.

error_ahead_level

An integer which represents how many steps further the parameters will be optimized for each data point.

Value

A lm object whose coefficients are optimized by the mentioned method.

Examples

df <- datasets::airquality

ordered_df <- df[with(df,order(Month,Day)),]

model <- xls.fit(Ozone ~ Solar.R + Wind + Temp,ordered_df,
error_weights = c(0.4,0.3,0.2,0.1),error_ahead_level = 4)

Preparing eXtreme Least Squares Nonlinear Objective Function

Description

Automatically used in xls.fit() No need to use if the objective function is not specifically desired to be achieved.

Usage

xls.objfun(data, error_column_name, error_weights, error_ahead_level)

Arguments

data

A data.frame object which is returned by xls.prep. Tip: xls.prep's .$data sub object returns the data.frame

error_column_name

Symbolic error column's name. By default, it is named "error_symbolic" by xls.prep()

error_weights

A numeric vector including error weights by order.

error_ahead_level

An integer which represents how many steps further the parameters will be optimized for each data point.

Value

A function object.


Preparing eXtreme Least Squares Data

Description

Automatically used in xls.fit() No need to use if the raw data is not specifically desired to be achieved.

Usage

xls.prep(formula, data, dependent_var)

Arguments

formula

An object of class "formula": a symbolic description of the model to be fitted.

data

A data.frame object.

dependent_var

A character which is the same as left hand side variable in specified formula.

Value

A list object which contains a data.frame object to be modeled and character vector of independent variables.