Lorenz.GA
estimates the coefficient vector of the single-index model.
It also returns the Lorenz-\(R^2\) of the regression as well as the estimated explained Gini coefficient.
Lorenz.GA(
y,
x,
standardize = TRUE,
weights = NULL,
popSize = 50,
maxiter = 1500,
run = 150,
suggestions = NULL,
ties.method = c("random", "mean"),
ties.Gini = c("random", "mean"),
seed.random = NULL,
seed.Gini = NULL,
seed.GA = NULL,
parallel.GA = FALSE
)
A list with several components:
theta
the estimated vector of parameters.
LR2
the Lorenz-\(R^2\) of the regression.
Gi.expl
the estimated explained Gini coefficient.
niter
number of iterations attained by the genetic algorithm.
fit
value attained by the fitness function at the optimum.
a vector of responses
a matrix of explanatory variables
Should the variables be standardized before the estimation process? Default value is TRUE.
vector of sample weights. By default, each observation is given the same weight.
Size of the population of candidates in the genetic algorithm. Default value is 50.
Maximum number ot iterations in the genetic algorithm. Default value is 1500.
Number of iterations without improvement in the best fitness necessary for the algorithm to stop. Default value is 150.
Initial guesses used in the genetic algorithm. The default value is NULL
, meaning no suggestions are passed.
Other possible values are a numeric matrix with at most popSize
rows and ncol(x)
columns, or a character string "OLS".
In the latter case, 0.5*popSize
suggestions are created as random perturbations of the OLS solutions.
What method should be used to break the ties in optimization program. Possible values are "random" (default value) or "mean". If "random" is selected, the ties are broken by further ranking in terms of a uniformly distributed random variable. If "mean" is selected, the average rank method is used.
what method should be used to break the ties in the computation of the Gini coefficient at the end of the algorithm. Possible values and default choice are the same as above.
An optional seed for generating the vector of uniform random variables used to break ties in the genetic algorithm. Defaults to NULL
, which means no specific seed is set.
An optional seed for generating the vector of uniform random variables used to break ties in the computation of the Gini coefficient. Defaults to NULL
, meaning no specific seed is applied.
An optional seed for ga
, used during the fitting of the genetic algorithm. Defaults to NULL
, implying that no specific seed is set.
Whether parallel computing should be used to distribute the computations in the genetic algorithm. Either a logical value determining whether parallel computing is used (TRUE) or not (FALSE, the default value). Or a numerical value determining the number of cores to use.
The genetic algorithm is solved using function ga
from the GA package. The fitness function is coded in Rcpp to speed up computation time.
When discrete covariates are introduced and ties occur in the index, the default option randomly breaks them, as advised in Section 3 of Heuchenne and Jacquemain (2022)
The parameters seed.random
, seed.Gini
, and seed.GA
allow for local seed setting to control randomness in specific parts of the function.
Each seed is applied to the respective part of the computation, and the seed is reverted to its previous state after the operation.
This ensures that the seed settings do not interfere with the global random state or other parts of the code.
Heuchenne, C. and A. Jacquemain (2022). Inference for monotone single-index conditional means: A Lorenz regression approach. Computational Statistics & Data Analysis 167(C).
Lorenz.Reg
, ga
data(Data.Incomes)
y <- Data.Incomes$Income
x <- cbind(Data.Incomes$Age, Data.Incomes$Work.Hours)
Lorenz.GA(y, x, popSize = 40)
Run the code above in your browser using DataLab