Search code examples
pythondata-sciencestatsmodelsquantile-regression

How to have multiple independent value columns using statsmodels quantreg


Right now I'm trying to use statsmodels.formula.api's quantreg by putting in the formula and the dataframe by doing smf.quantreg('<independant values> ~ <dependant values>', df).fit(q=0.9) like in https://www.statology.org/quantile-regression-in-python/ However I cannot find how to structure the formula in a way to take multiple independant values, I have tried going with the structure of 'xValue1, xValue2 ~ yValue' however this causes me to get row mismatch error, making me think that statsmodels is assuming my xValues are rows and not columns.


Solution

  • This should work

    smf.quantreg('yValue ~ xValue1 + xValue2 + xValue3', df).fit(q=0.9)