Comments (5)
What is the intention of the first formula? What is exogenous and what is endogenous? Clearly the Z are instruments.
.
from formulaic.
Returning to this after several years 😓 .
Multi-part formulas are already implemented as of v0.3.0
: y ~ a | b | c
does the right thing.
@bashtage : If I were to take this further, I'd look to implement something like: y ~ 1 + x1 + x2 + x3 + [ x4 + x5 ~ z1 + z2 + z3]
, exactly as you have done here. The results would be made available on the Structured
instance as something like:
.lhs
y
.rhs
1 + x1 + x2 + x3 + IV[x4] + IV[x5]
.iv_x4:
z1 + z2 + z3
.iv_x5:
z1 + z2 + z3
This is within reach of the parser now, but I'd love your take on this (given that you have much more experience in this space).
from formulaic.
An advanced syntax would be great. I have a few current uses.
- IV like you have above.
- Absorbing regression where high dimensional fixed effects are absorbed. Something like
y ~ x + [eff1 + eff2 + eff3]
whereeff#
are categorical variables usually that are then encoded to sparse arrays. - Systems equations. I currently use a dictionary. These models have multiple equations, something like
y1 ~ x + z, y2 ~ x + w
. Not sure if something like this woudl make sense to have as a syntax.
from formulaic.
Nice. I don't yet know how much it makes sense to always have these advanced operators in place (versus having a family of parsers that extend some common set), but I'll definitely be working toward making the parser capable of generating formulae for these kinds of situations.
For further clarity:
On 2. Absorbing regression is just your usual fixed-effects regression, right? Where you demean the data based on a set of covariates prior to modelling, perhaps using another regression? What would you want output in that case? Something like:
.lhs
y_residuals
.fixed_effects
eff1 + eff2 + eff3
.rhs
x
On 3. Would a Structured
instance of a tuple of formulas work? That could be implemented trivially today (either in formulaic or downstream by adding the ,
operator):
[0]
.rhs
y1
.lhs
x + z
[1]
...
from formulaic.
I haven't really through about it. I could imagine that formulas could be nested. For example
y ~ 1 + x + [w ~ z]
could be something like
.lhs
y
.rhs
1 + x + [w ~ z]
and when you access .rhs
it would be [1{Term}, x{Term}, [w ~ z]{Formula}] so that one could handle nested formulas with some recusions, e.g.
for term_or_fmla in formula.rhs.terms:
if isinstance(term_or_fmla , Term):
"""Do something"""
else:
"""Handle nested formula probably using a recursion"""
Maybe too complicted.
from formulaic.
Related Issues (20)
- drop both columns in dependent variable and design matrix when missings occur HOT 5
- DOC: Explicitly mention support for multiple variables on the left hand side HOT 3
- Terms not being evaluated in get_model_matrix() HOT 2
- 17 tests fail: ModuleNotFoundError: No module named 'interface_meta' HOT 2
- How can the encoding choices for one dataset be reused for another? HOT 3
- Intercept term breaks when RHS formula begins with a parentheses HOT 2
- How do I set the reference level for a categorical term? HOT 4
- Support for sympy >= 1.10 HOT 3
- ENH: Preserve variable order as they appear in formulas HOT 5
- 2 tests fail HOT 1
- Interaction between two categorical covariates sometimes switches order, causing error HOT 3
- Intercept is not added after being removed HOT 4
- Proposal: support columns representing multiple features HOT 3
- Formulaic struggles with NAs and `poly()` syntax HOT 3
- Escaped variables and functions HOT 3
- How to include structural zeros? HOT 1
- Retain Column Names for sparse model matrices HOT 4
- Formulaic not raising an exception when required fields are missing in the dataset HOT 2
- Allow formatting the categorical encoded variables HOT 4
- Throw error when formula has parameters that are not available HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from formulaic.