There is such a task: to build a linear regression based on the available data (dtfr) and the "formula", which is stored in a text file txt. Those. you need to determine the coefficients in the regressors, make summary, in one word.

Initially, the formula is read into a string, so how to make it perceived as an expression by which the regression will be built, and not as a string? I would be very grateful for the help, for the first time I use Python. enter image description here

  • one
    Can you see this formula? - Pavel Durmanov
  • Something like that GRP ~ Price + Pension + Science + Value are the names of the columns in the data frame. Maybe it should somehow look different in the text file? - Alex
  • What error smf.ols ? - MaxU
  • @MaxU Model is missing required outcome variables - Alex
  • 2
    Paste the code directly into the message, not as a picture. - Mikhail Vaysman

0