Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] sw equivalent for weights #536

Open
FBrunamonti opened this issue Jan 14, 2025 · 0 comments
Open

[Request] sw equivalent for weights #536

FBrunamonti opened this issue Jan 14, 2025 · 0 comments

Comments

@FBrunamonti
Copy link

I often need to run the same regression with different sets of weights, and compare results. For example:

df <- tribble(
  ~country,       ~gdp,    ~interest_rate, ~population, ~weights,
  "Country A",   50000,          3.5,      1000000,     0.1,
  "Country B",   80000,          4.2,      5000000,     0.15,
  "Country C",   120000,         2.8,      8000000,     0.2,
  "Country D",   25000,          5.0,      2000000,     0.05
)

formula = as.formula("gdp ~ interest_rate")

reg1 <- feols(formula, data = df, weights = 1)
reg2 <- feols(formula, data = df, weights = ~population)
reg3 <- feols(formula, data = df, weights = ~weights)

etable(list(reg1, reg2, reg3))

Is it possible to have an equivalent version of the sw function for weights, so that it would be possible to specify a single regression, and run it over different sets of weights?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant