Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quantile Regression with multiple independent variables?

Is it possible to run a Quantile REgression using multiple independent variables (x). Using Python I tried statsmodel

mod = smf.quantreg(y, X)
res = mod.fit(q=.5)
print(res.summary())

Where y and X are Pandas dataframes. This works for OLS, however for quantile regression I does not.

How would you go about performing this?

like image 430
Oscar Dyremyhr Avatar asked Dec 19 '25 08:12

Oscar Dyremyhr


1 Answers

Another way to do quantreg with multiple columns (when you don’t want to write out each variable) is to do something like this:

Mod = smf.quantreg(f”y_var~ {' + '.join(df.columns[1:])}”)

Res = mod.fit(q=0.5)

print(res.summary())

Where my y variable (y_var) is the first column in my data frame.

like image 62
Megan Avatar answered Dec 20 '25 22:12

Megan