-
Notifications
You must be signed in to change notification settings - Fork 32
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
Simplify forumulae #215
Comments
This could be done programmatically, e.g. julia> varnames = map(x -> "t$x", [1:79; 81:120])
julia> fe = x -> x # define dummy FE
julia> form = term(:hpg) ~ sum(term.(varnames)) + @formula(0~fe(loc) + fe(Date)).rhs The handling of You could also define an operator / FunctionTerm at the package level that does that type of expansion and returns a matrix term. This is how random effects are handled in MixedModels.jl. |
@palday thank you. aa=unique(sort(df.Date)) # 120 months 2010-2020
for jj in 1:size(aa,1)
col = "t" * string(jj) #string(jj) # string(aa[jj])
df[!, col] = (df.loc .== "Greater_Vancouver") .* (df.Date .== aa[jj])
end
PT = map(x -> "t$x", [1:79; 81:120])
f = term(:hpg) ~ sum(term.(PT)) + @formula(0~fe(loc) + fe(Date)).rhs
m_dyndid1 = reg(df, f, Vcov.cluster(:loc)) #works
m_ife = regife(df, f, Vcov.cluster(:loc)) #ERROR: type Nothing has no field id |
I guess one question is why don’t you simply create a categorical variable for dates? Then simply add the variable in the formula. You can specify the base level using keyword argument. |
This seems resolved/like an issue for |
Hey and thank you for this package!
I have a Diff-In-Diff w/ many hand-made variables:
Can this be automated like in STATA?
The text was updated successfully, but these errors were encountered: