-
arpoon.rfixest.Fixest.feols(fml: str, vcov: str =
None
, weights: str =None
, offset=None
, subset=None
, split: str =None
, fsplit: str =None
, split_keep=None
, split_drop=None
, cluster: list | str =None
, ssc: dict =None
, panel_id=None
, fixef=None
, fixef_rm: 'perfect' | 'singleton' | 'both' | 'none' ='perfect'
, fixef_tol: int =1e-06
, fixef_iter: int =10000
, collin_tol: int =1e-10
, nthreads: int =None
, lean: bool =False
, verbose: int =0
, warn: bool =True
, notes=None
, only_coef: bool =False
, combine_quick=None
, mem_clean: bool =False
, only_env: bool =False
, env=None
, demeaned: bool =False
, *, name: str =None
, keep_est: bool =True
) FixestOLS Estimates OLS with any number of fixed-effects, by calling
r-fixest
feolsExample (continued): gravity ols
Example continued from
arpoon.rfixest.Fixest
In [1]: ols = fixest.feols( ...: "Euros ~ log(dist_km) | Origin + Destination + Product + Year" ...: ) ...: In [2]: ols Out[2]: OLS estimation, Dep. Var.: Euros Observations: 38,325 Fixed-effects: Origin: 15, Destination: 15, Product: 20, Year: 10 Standard-errors: Clustered (Origin) Estimate Std. Error t value Pr(>|t|) log(dist_km) -66754618 14306507 -4.66603 0.00036385 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 RMSE: 116,958,376.0 Adj. R2: 0.303863 Within R2: 0.055781
Now the
Fixest
object has a cache which stores the estimationsIn [3]: fixest Out[3]: Fixest In [4]: etable = fixest.etable() model 1 model 2 Dependent Var.: Euros Euros log(dist_km) -1.528*** (0.1157) -66,754,618.0*** (14,306,507.3) Fixed-Effects: ------------------ ------------------------------ Origin Yes Yes Destination Yes Yes Product Yes Yes Year Yes Yes _______________ __________________ ______________________________ Family Poisson OLS S.E.: Clustered by: Origin by: Origin Observations 38,325 38,325 Squared Cor. 0.61202 0.30490 Pseudo R2 0.76403 0.00901 BIC 1.4e+12 1,533,326.0 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 In [5]: etable Out[5]: shape: (15, 3) ┌─────────────────┬────────────────────┬─────────────────────────────────┐ │ info ┆ feglm_poisson.0 ┆ feols.1 │ │ --- ┆ --- ┆ --- │ │ str ┆ str ┆ str │ ╞═════════════════╪════════════════════╪═════════════════════════════════╡ │ Dependent Var.: ┆ Euros ┆ Euros │ │ ┆ ┆ │ │ log(dist_km) ┆ -1.528*** (0.1157) ┆ -66,754,618.0*** (14,306,507.3… │ │ Fixed-Effects: ┆ ------------------ ┆ ------------------------------ │ │ Origin ┆ Yes ┆ Yes │ │ … ┆ … ┆ … │ │ S.E.: Clustered ┆ by: Origin ┆ by: Origin │ │ Observations ┆ 38,325 ┆ 38,325 │ │ Squared Cor. ┆ 0.61202 ┆ 0.30490 │ │ Pseudo R2 ┆ 0.76403 ┆ 0.00901 │ │ BIC ┆ 1.4e+12 ┆ 1,533,326.0 │ └─────────────────┴────────────────────┴─────────────────────────────────┘ In [6]: fixest.etable(tex=True) \begingroup \centering \begin{tabular}{lcc} \tabularnewline \midrule \midrule Dependent Variable: & \multicolumn{2}{c}{Euros}\\ Model: & (1) & (2)\\ & Poisson & OLS\\ \midrule \emph{Variables}\\ log(dist\_km) & -1.528$^{***}$ & -66,754,618.0$^{***}$\\ & (0.1157) & (14,306,507.3)\\ \midrule \emph{Fixed-effects}\\ Origin & Yes & Yes\\ Destination & Yes & Yes\\ Product & Yes & Yes\\ Year & Yes & Yes\\ \midrule \emph{Fit statistics}\\ Observations & 38,325 & 38,325\\ Squared Correlation & 0.61202 & 0.30490\\ Pseudo R$^2$ & 0.76403 & 0.00901\\ BIC & $1.4\times 10^{12}$ & 1,533,326.0\\ \midrule \midrule \multicolumn{3}{l}{\emph{Clustered (Origin) standard-errors in parentheses}}\\ \multicolumn{3}{l}{\emph{Signif. Codes: ***: 0.01, **: 0.05, *: 0.1}}\\ \end{tabular} \par\endgroup Out[6]: '\\begingroup\n\\centering\n\\begin{tabular}{lcc}\n \\tabularnewline \\midrule \\midrule\n Dependent Variable: & \\multicolumn{2}{c}{Euros}\\\\\n Model: & (1) & (2)\\\\ \n & Poisson & OLS\\\\ \n \\midrule\n \\emph{Variables}\\\\\n log(dist\\_km) & -1.528$^{***}$ & -66,754,618.0$^{***}$\\\\ \n & (0.1157) & (14,306,507.3)\\\\ \n \\midrule\n \\emph{Fixed-effects}\\\\\n Origin & Yes & Yes\\\\ \n Destination & Yes & Yes\\\\ \n Product & Yes & Yes\\\\ \n Year & Yes & Yes\\\\ \n \\midrule\n \\emph{Fit statistics}\\\\\n Observations & 38,325 & 38,325\\\\ \n Squared Correlation & 0.61202 & 0.30490\\\\ \n Pseudo R$^2$ & 0.76403 & 0.00901\\\\ \n BIC & $1.4\\times 10^{12}$ & 1,533,326.0\\\\ \n \\midrule \\midrule\n \\multicolumn{3}{l}{\\emph{Clustered (Origin) standard-errors in parentheses}}\\\\\n \\multicolumn{3}{l}{\\emph{Signif. Codes: ***: 0.01, **: 0.05, *: 0.1}}\\\\\n\\end{tabular}\n\\par\\endgroup'