Learn R Programming

fixest (version 0.3.1)

update.fixest: Updates a fixest estimation

Description

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.

Usage

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

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 clusters. 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.

...

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.

Examples

Run this code
# NOT RUN {
# Example using trade data
data(trade)

# main estimation
est_pois <- femlm(Euros ~ log(dist_km) | Origin + Destination, trade)

# we add the variable log(Year)
est_2 <- update(est_pois, . ~ . + log(Year))

# we add another cluster: "Product"
est_3 <- update(est_2, . ~ . | . + Product)

# we remove the cluster "Origin" and the variable log(dist_km)
est_4 <- update(est_3, . ~ . - log(dist_km) | . - Origin)

# Quick look at the 4 estimations
esttable(est_pois, est_2, est_3, est_4)

# }

Run the code above in your browser using DataLab