I'm working with empirical data and have estimated the non-linear marginal effects of my independent variable in my dependent variable. Let's call these marginal effects $\frac{dy}{dx}(x)$.
Is there any method by which I can "approximate" the functional form of $y(x)$? I've looked into numerical integration but it is my understanding that this procedure estimates the definite integral.
I tried fitting a polynomial regression on the estimated marginal effects, integrating that and adding the average of my data for $y$ as the constant term. I then used this function to generate the "estimated integral". The result was pretty somewhat noisy so I smoothed the values with LOWESS (locally weighted scatterplot smoothing).
This works fine, but I'm wondering if there's a more sophisticated way of going about things. I'm worried that I'm losing information because the polynomial fit, though pretty good, isn't perfect ($R^2=0.99$) and I don't know how much the choice of polynomial can affect the results. I add graphs of my results (for positive values) below. Thanks in advance!


