Closed Simon-Schulten closed 3 months ago
Hi, this is normal. Let's look at the formula you're throwing into the model:
update(base_model_doesnt, . ~ x4 + .)
#> c(y1, y2) ~ x4 + (x1 + sw(x2, x3) | f)
This is simply not valid.
What you want is:
c(y1, y2) ~ x4 + x1 + sw(x2, x3) | f
The update.formula
method does not work here, and it is not due to fixest
.
I'm afraid you have to do differently.
Thanks for confirming this is indeed invalid usage. Will find a different way.
I've added the method update.fixest_multi
. You can update the estimation directly and not the formula:
est_1 = feols(c(y1, y2) ~ x1 + sw(x2, x3) | f, df)
est_2 = update(est_1, . ~ x4 + .)
etable(est_2)
#> est_2.1 est_2.2 est_2.3 est_2.4
#> Dependent Var.: y1 y1 y2 y2
#>
#> x4 0.4712** (0.0061) 0.4788* (0.0313) 0.4712** (0.0061) 0.4788* (0.0313)
#> x1 1.124** (0.0114) 0.9525. (0.0807) 1.124** (0.0114) 0.9525. (0.0807)
#> x2 1.999* (0.0663) 1.999* (0.0663)
#> x3 4.942** (0.0291) 4.942** (0.0291)
#> Fixed-Effects: ----------------- ---------------- ----------------- ----------------
#> f Yes Yes Yes Yes
#> _______________ _________________ ________________ _________________ ________________
#> S.E.: Clustered by: f by: f by: f by: f
#> Observations 10,000 10,000 10,000 10,000
#> R2 0.12849 0.61462 0.12849 0.61462
#> Within R2 0.12843 0.61459 0.12843 0.61459
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Hi there, when I try to update a base model that includes stepwise function and fixed effects, I get an error that I can't combine stepwise functions with any other element. I do not quite understand why that is, but this usage does not seem "too far out there" to me.
Reproducible example below: