Updates and re-estimates a fixest
model (estimated with femlm
, feols
or feglm
).
This function updates the formulas and use previous starting values to estimate a new
fixest
model. The data is obtained from the original call
.
Arguments
- object
A
fixest
orfixest_multi
object. These are obtained fromfeols
, orfeglm
estimations, for example.- fml.update
Changes to be made to the original argument
fml
. See more information onupdate.formula
. You can add/withdraw both variables and fixed-effects. E.g.. ~ . + x2 | . + z2
would add the variablex2
and the fixed-effectz2
to the former estimation.- nframes
(Advanced users.) Defaults to 1. Number of frames up the stack where to perform the evaluation of the updated call. By default, this is the parent frame.
- evaluate
Logical, default is
TRUE
. IfFALSE
, only the updated call is returned.- ...
Other arguments to be passed to the functions
femlm
,feols
orfeglm
.
See also
See also the main estimation functions femlm
, feols
or feglm
. predict.fixest
, summary.fixest
, vcov.fixest
, fixef.fixest
.
Examples
# Example using trade data
data(trade)
# main estimation
est_pois = fepois(Euros ~ log(dist_km) | Origin + Destination, trade)
# we add the variable log(Year)
est_2 = update(est_pois, . ~ . + log(Year))
# we add another fixed-effect: "Product"
est_3 = update(est_2, . ~ . | . + Product)
# we remove the fixed-effect "Origin" and the variable log(dist_km)
est_4 = update(est_3, . ~ . - log(dist_km) | . - Origin)
# Quick look at the 4 estimations
etable(est_pois, est_2, est_3, est_4)
#> est_pois est_2 est_3
#> Dependent Var.: Euros Euros Euros
#>
#> log(dist_km) -1.517*** (0.1131) -1.518*** (0.1132) -1.528*** (0.1157)
#> log(Year) 72.37*** (6.900) 72.62*** (6.983)
#> Fixed-Effects: ------------------ ------------------ ------------------
#> Origin Yes Yes Yes
#> Destination Yes Yes Yes
#> Product No No Yes
#> _______________ __________________ __________________ __________________
#> S.E.: Clustered by: Origin by: Origin by: Origin
#> Observations 38,325 38,325 38,325
#> Squared Cor. 0.37832 0.38444 0.61155
#> Pseudo R2 0.58950 0.59290 0.76381
#> BIC 2.44e+12 2.42e+12 1.41e+12
#>
#> est_4
#> Dependent Var.: Euros
#>
#> log(dist_km)
#> log(Year) 70.82*** (5.989)
#> Fixed-Effects: ----------------
#> Origin No
#> Destination Yes
#> Product Yes
#> _______________ ________________
#> S.E.: Clustered by: Destination
#> Observations 38,325
#> Squared Cor. 0.17893
#> Pseudo R2 0.35377
#> BIC 3.85e+12
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1