Subsets a fixest_multi object using different keys.
## S3 method for class 'fixest_multi'x[i, sample, lhs, rhs, fixef, iv, I, reorder =TRUE, drop =FALSE]
Arguments
x: A fixest_multi object, obtained from a fixest estimation leading to multiple results.
i: An integer vector. Represents the estimations to extract.
sample: An integer vector, a logical scalar, or a character vector. It represents the sample identifiers for which the results should be extracted. Only valid when the fixest estimation was a split sample. You can use .N to refer to the last element. If logical, all elements are selected in both cases, but FALSE leads sample to become the rightmost key (just try it out).
lhs: An integer vector, a logical scalar, or a character vector. It represents the left-hand-sides identifiers for which the results should be extracted. Only valid when the fixest estimation contained multiple left-hand-sides. You can use .N to refer to the last element. If logical, all elements are selected in both cases, but FALSE
leads lhs to become the rightmost key (just try it out).
rhs: An integer vector or a logical scalar. It represents the right-hand-sides identifiers for which the results should be extracted. Only valid when the fixest
estimation contained multiple right-hand-sides. You can use .N to refer to the last element. If logical, all elements are selected in both cases, but FALSE leads rhs to become the rightmost key (just try it out).
fixef: An integer vector or a logical scalar. It represents the fixed-effects identifiers for which the results should be extracted. Only valid when the fixest
estimation contained fixed-effects in a stepwise fashion. You can use .N to refer to the last element. If logical, all elements are selected in both cases, but FALSE leads fixef
to become the rightmost key (just try it out).
iv: An integer vector or a logical scalar. It represent the stages of the IV. Note that the length can be greater than 2 when there are multiple endogenous regressors (the first stage corresponding to multiple estimations). Note that the order of the stages depends on the stage argument from summary.fixest. If logical, all elements are selected in both cases, but FALSE leads iv to become the rightmost key (just try it out).
I: An integer vector. Represents the root element to extract.
reorder: Logical, default is TRUE. Indicates whether reordering of the results should be performed depending on the user input.
drop: Logical, default is FALSE. If the result contains only one estimation, then if drop = TRUE it will be transformed into a fixest object (instead of fixest_multi). Its default value can be modified with the function setFixest_multi.
Returns
It returns a fixest_multi object. If there is only one estimation left in the object, then the result is simplified into a fixest object only with drop = TRUE.
Details
The order with we we use the keys matter. Every time a key sample, lhs, rhs, fixef or iv is used, a reordering is performed to consider the leftmost-side key to be the new root.
Use logical keys to easily reorder. For example, say the object res contains a multiple estimation with multiple left-hand-sides, right-hand-sides and fixed-effects. By default the results are ordered as follows: lhs, fixef, rhs. If you use res[lhs = FALSE], then the new order is: fixef, rhs, lhs. With res[rhs = TRUE, lhs = FALSE] it becomes: rhs, fixef, lhs. In both cases you keep all estimations.
Examples
# Estimation with multiple samples/LHS/RHSaq = airquality[airquality$Month %in%5:6,]est_split = feols(c(Ozone, Solar.R)~ sw(poly(Wind,2), poly(Temp,2)), aq, split =~ Month)# By default: sample is the rootetable(est_split)# Let's reorder, by considering lhs the rootetable(est_split[lhs =1:.N])# Selecting only one LHS and RHSetable(est_split[lhs ="Ozone", rhs =1])# Taking the first root (here sample = 5)etable(est_split[I =1])# The first and last estimationsetable(est_split[i = c(1, .N)])
See Also
The main fixest estimation functions: feols, fepois, fenegbin, feglm, feNmlm. Tools for mutliple fixest estimations: summary.fixest_multi, print.fixest_multi, as.list.fixest_multi, sub-sub-.fixest_multi, sub-.fixest_multi.