Simple function that replicates fixest
objects while (optionally) computing different
standard-errors. Useful mostly in combination with etable
or coefplot
.
Arguments
- x
Either a
fixest
object, either a list offixest
objects created with.l()
.- times
Integer vector giving the number of repetitions of the vector of elements. By default
times = 1
. It must be either of length 1, either of the same length as the argumentx
.- each
Integer scalar indicating the repetition of each element. Default is 1.
- vcov
A list containing the types of standard-error to be computed, default is missing. If not missing, it must be of the same length as
times
,each
, or the final vector. Note that if the argumentstimes
andeach
are missing, thentimes
becomes equal to the length ofvcov
. To see how to summon a VCOV, see the dedicated section in the vignette.- ...
In
.l()
:fixest
objects. Inrep()
: not currently used.
Details
To apply rep.fixest
on a list of fixest
objects, it is absolutely necessary to use
.l()
and not list()
.
Examples
# Let's show results with different standard-errors
est = feols(Ozone ~ Solar.R + Wind + Temp, data = airquality)
#> NOTE: 42 observations removed because of NA values (LHS: 37, RHS: 7).
my_vcov = list(~ Month, ~ Day, ~ Day + Month)
etable(rep(est, vcov = my_vcov))
#> model 1.1 model 1.2 model 1.3
#> Dependent Var.: Ozone Ozone Ozone
#>
#> Constant -64.34* (21.30) -64.34** (20.15) -64.34* (19.66)
#> Solar.R 0.0598 (0.0335) 0.0598*** (0.0162) 0.0598 (0.0314)
#> Wind -3.334* (1.181) -3.334*** (0.8343) -3.334* (1.135)
#> Temp 1.652*** (0.1583) 1.652*** (0.1927) 1.652*** (0.1386)
#> _______________ _________________ __________________ _________________
#> S.E.: Clustered by: Month by: Day by: Day & Month
#> Observations 111 111 111
#> R2 0.60589 0.60589 0.60589
#> Adj. R2 0.59484 0.59484 0.59484
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
coefplot(rep(est, vcov = my_vcov), drop = "Int")
#
# To rep multiple objects, you need to use .l()
#
est_bis = feols(Ozone ~ Solar.R + Wind + Temp | Month, airquality)
#> NOTE: 42 observations removed because of NA values (LHS: 37, RHS: 7).
etable(rep(.l(est, est_bis), vcov = my_vcov))
#> model 1.1 model 2.1 model 1.2
#> Dependent Var.: Ozone Ozone Ozone
#>
#> Constant -64.34* (21.30) -64.34** (20.15)
#> Solar.R 0.0598 (0.0335) 0.0522 (0.0408) 0.0598*** (0.0162)
#> Wind -3.334* (1.181) -3.109. (1.306) -3.334*** (0.8343)
#> Temp 1.652*** (0.1583) 1.875*** (0.1816) 1.652*** (0.1927)
#> Fixed-Effects: ----------------- ----------------- ------------------
#> Month No Yes No
#> _______________ _________________ _________________ __________________
#> S.E.: Clustered by: Month by: Month by: Day
#> Observations 111 111 111
#> R2 0.60589 0.63686 0.60589
#> Within R2 -- 0.53154 --
#>
#> model 2.2 model 1.3 model 2.3
#> Dependent Var.: Ozone Ozone Ozone
#>
#> Constant -64.34* (19.66)
#> Solar.R 0.0522* (0.0202) 0.0598 (0.0314) 0.0522 (0.0391)
#> Wind -3.109*** (0.7986) -3.334* (1.135) -3.109. (1.215)
#> Temp 1.875*** (0.3671) 1.652*** (0.1386) 1.875** (0.2209)
#> Fixed-Effects: ------------------ ----------------- ----------------
#> Month Yes No Yes
#> _______________ __________________ _________________ ________________
#> S.E.: Clustered by: Day by: Day & Month by: Day & Month
#> Observations 111 111 111
#> R2 0.63686 0.60589 0.63686
#> Within R2 0.53154 -- 0.53154
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# using each
etable(rep(.l(est, est_bis), each = 3, vcov = my_vcov))
#> model 1.1 model 1.2 model 1.3
#> Dependent Var.: Ozone Ozone Ozone
#>
#> Constant -64.34* (21.30) -64.34** (20.15) -64.34* (19.66)
#> Solar.R 0.0598 (0.0335) 0.0598*** (0.0162) 0.0598 (0.0314)
#> Wind -3.334* (1.181) -3.334*** (0.8343) -3.334* (1.135)
#> Temp 1.652*** (0.1583) 1.652*** (0.1927) 1.652*** (0.1386)
#> Fixed-Effects: ----------------- ------------------ -----------------
#> Month No No No
#> _______________ _________________ __________________ _________________
#> S.E.: Clustered by: Month by: Day by: Day & Month
#> Observations 111 111 111
#> R2 0.60589 0.60589 0.60589
#> Within R2 -- -- --
#>
#> model 2.1 model 2.2 model 2.3
#> Dependent Var.: Ozone Ozone Ozone
#>
#> Constant
#> Solar.R 0.0522 (0.0408) 0.0522* (0.0202) 0.0522 (0.0391)
#> Wind -3.109. (1.306) -3.109*** (0.7986) -3.109. (1.215)
#> Temp 1.875*** (0.1816) 1.875*** (0.3671) 1.875** (0.2209)
#> Fixed-Effects: ----------------- ------------------ ----------------
#> Month Yes Yes Yes
#> _______________ _________________ __________________ ________________
#> S.E.: Clustered by: Month by: Day by: Day & Month
#> Observations 111 111 111
#> R2 0.63686 0.63686 0.63686
#> Within R2 0.53154 0.53154 0.53154
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1