我正在使用以下数据格式,称为test
y intercept x
0 -1.6168468132687293 1 NA
1 1.5500031232431757 1 NA
2 1.5952617833602785 1 1.5500031232431757
3 1.1390724309357498 1 1.5952617833602785
4 0.9950311340335872 1 1.1390724309357498
5 0.7095780139613861 1 0.9950311340335872
6 0.5962529862944801 1 0.7095780139613861
7 0.6555353674581792 1 0.5962529862944801
8 1.0008751093886736 1 0.6555353674581792
9 1.2648319050758074 1 1.0008751093886736我正试图将smf.quantreg()函数应用于数据文件,如下所示:
import statsmodels.formula.api as smf
Output_pre = smf.quantreg('y ~ intercept + x', test , missing = 'drop')
Output = Output_pre.fit(q=0.25)等效的标准statsmodels.ols()函数工作得很好。但是,应用smf.quantreg()函数会产生以下错误:
ValueError: operands could not be broadcast together with shapes (3,) (2,) 为什么是这样,我如何解决这个问题呢?
发布于 2022-09-14 10:45:45
我自己发现的。默认情况下,该函数提供一个截取。因此,当包含第二个截距(两列是完全共线性的)时,输入矩阵不是满秩的。
https://stackoverflow.com/questions/73714743
复制相似问题