Generating list of rsquared_adj regression values for variating i with loop
alexander.hempfing at googlemail.com
Wed Apr 18 13:19:35 EDT 2018
I am wondering if someone could please help me with an issue I am currently trying to solve:
I have a "static" code which looks as follows:
reg_list_fra = list([tsd_res_fra_08,tsd_res_fra_09,tsd_res_fra_10,tsd_res_fra_11,tsd_res_fra_12,tsd_res_fra_13,tsd_res_fra_14,tsd_res_fra_15])
fra_gdp = fra_gdpseries.tolist()
import statsmodels.api as sm
X = reg_list_fra
y = fra_gdp
X = sm.add_constant(X)
model = sm.OLS(y, X).fit()
predictions = model.predict(X)
Now I would like to generate a "dynamic" code by replacing 100 in the top eight rows to i and let it run from 1 to 1000, thereby running the regression below for every i and save its rsquared_adjvalue in a new list, which contains the rsquared_adj values for i=1, i=2,... i=1000. y stays "static" the whole time.
Can someone please help me here?
More information about the Python-list