I have a csv file with around 1000 regression results looking like this:
x^4_coeff x^3_coeff x^2_coeff x_coeff intercept
10 -.43 0.05 12 298
from the first set of coefficients I get an equation of:
10x4 -0.43x3 + 0.05x2 + 12x + 298
I want to automate calculating a first derivative which will be:
40x3 - 1.29x2 + 0.1x + 12
Then I would like to resolve this equation for 0 and find all the roots
After that I would like to get a second derivative which in this case would be: 12x2 - 2.58x + 0.1 and find both roots of this function
I would like to store the results in a csv file for a comparison, the points is to find out if there are some commonalities between all 1000 regressions and what is a difference between roots of first and second derivative for these equations.
I haven't calculated the roots manually so these values are dummy but hope you get the point
_root1 fd_root2 fd_root3 sd_root1 sd_root2
10 20 25 13 15
and do this for all my 1000 regression results. Is there a quick way to do this in python? What I have done so far was generating those 1000 regression outputs in Stata (which I don't know really well), saved the output to a csv file and thought it will be easier to carry on with Python.
Thanks for your help!