dexpectilizeVecR {erfe}R Documentation

Dexpectilize a vector according the a single asymmetric point \tau\in (0, 1).

Description

This function is part of the erfe package. It de-expectilizes a vector of data, which means subtracting the expectile of level \tau\in (0, 1) of the vector to the vector itself. When \tau=0.5 then the process of de-expectilizing corresponds to the process of deamining the vector. That is, subtracting the mean of the vector from the vector itself.

Usage

dexpectilizeVecR(yvec, aweight, panSizeVec)

Arguments

yvec

Numeric vector to de-expectilize.

aweight

Numeric vector of individual asymmetric weight.

panSizeVec

Numeric vector of individual panel size.

Value

Return a de-expectilized vector of the vector yvec.

Author(s)

Amadou Barry, barryhafia@gmail.com

References

Barry, Amadou, Oualkacha, Karim, and Charpentier Arthur. (2022). Weighted asymmetric least squares regression with fixed-effects. arXiv preprint arXiv:2108.04737

Examples

set.seed(13)
temps_obs <- 5 # panel size
n_subj <- 50 # sample size
id <- rep(1:n_subj, each = temps_obs)
asym <- 0.5
panSizeVec <- unname(unlist(lapply(split(id, id), function(x) length(x))))
yvec <- c(mvtnorm::rmvnorm(n_subj, sigma = diag(rep(1,temps_obs))))
aweight <- rep(asym, temps_obs * n_subj)
aweight[!(yvec > mean(yvec))] = 1 - asym
dexpectilizeVecR(yvec, aweight, panSizeVec)

[Package erfe version 0.0.1 Index]