问题描述
现在我正在尝试使用 statsmodels.formula.api 的 quantreg,方法是在 https://www.statology.org/quantile-regression-in-python/ 中执行 smf.quantreg('<independant values> ~ <dependant values>',df).fit(q=0.9)
放入公式和数据框,但是我找不到如何在取多个独立值的方法,我尝试使用 'xValue1,xValue2 ~ yValue' 的结构,但这导致我得到行不匹配错误,让我认为 statsmodels 假设我的 xValues 是行而不是列。
解决方法
这应该有效
smf.quantreg('yValue ~ xValue1 + xValue2 + xValue3',df).fit(q=0.9)