Quantile Regression with multiple independent variables?

Viewed 1521

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?

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.

Related