Learn R Programming

LorenzRegression (version 2.2.0)

.Fitness_cpp: Computes the fitness used in the GA

Description

Computes the fitness of a candidate in the genetic algorithm displayed in function Lorenz.GA.cpp

Usage

.Fitness_cpp(x, Y, X, Z, pi, tolerance)

Value

Fitness of candidate x

Arguments

x

vector of size (p-1) giving the proposed candidate, where p is the number of covariates

Y

vector of size n gathering the response, where n is the sample size

X

matrix of dimension (n*p) gathering the covariates

Z

vector of size n gathering iid repetitions of a U[0,1]

pi

vector of size n gathering the observation weights (notice that sum(pi)=1)

tolerance

A small positive number used to determine the threshold for considering two floating-point numbers as equal. This is primarily used to address issues with floating-point precision when comparing values that should theoretically be identical but may differ slightly due to numerical inaccuracies.