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.

# S3 method for fixest
update(object, fml.update, nframes = 1, evaluate = TRUE, ...)

Arguments

object

A fixest object. Obtained using the functions femlm, feols or feglm.

fml.update

Changes to be made to the original argument fml. See more information on update.formula. You can add/withdraw both variables and fixed-effects. E.g. . ~ . + x2 | . + z2 would add the variable x2 and the cluster z2 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. If FALSE, only the updated call is returned.

...

Other arguments to be passed to the functions femlm, feols or feglm.

Value

It returns a fixest object (see details in femlm, feols or feglm).

See also

See also the main estimation functions femlm, feols or feglm. predict.fixest, summary.fixest, vcov.fixest, fixef.fixest.

Author

Laurent Berge

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:    ------------------ ------------------ ------------------
#> Country of 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:    ----------------
#> Country of 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