ValueError:exog没有完整的列排名 [英] ValueError: exog does not have full column rank

查看:896
本文介绍了ValueError:exog没有完整的列排名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从通常情况下,缺少某些观察结果.当我在R中运行等效命令时(我认为等效命令为plm),我得到以下信息:

As must very often be the case, some observations are missing. When I run the equivalent command in R (I think the equivalent command is plm) I get the following:

Unbalanced Panel: n=11, T=17-61, N=531

因此面板是不平衡的:有些人只拥有17个时间段的完整数据,而另一些人则具有更多时间.但是回归仍然运行.

So the panel is unbalanced: some of the individuals only have complete data for 17 time periods and others for many more. But the regression runs nevertheless.

等效的python命令是:

The equivalent python command is:

import linearmodels.panel as pnl
model = pnl.PanelOLS.from_formula(formula, data=src)

哪个会向我发出警告:

输入包含缺失值.删除缺少观察结果的行.

Inputs contain missing values. Dropping rows with missing observations.

还有一个错误:

MyPythonInstallation\lib\site-packages\linearmodels\panel\model.py in _validate_data(self)
    207 
    208         if matrix_rank(x) < x.shape[1]:
--> 209             raise ValueError('exog does not have full column rank.')
    210         self._constant, self._constant_index = has_constant(x)
    211 

ValueError: exog does not have full column rank.

如何进行回归分析?

推荐答案

我有相同的错误.在我的情况下,我正在使用的数据帧的列之一被视为对象"数据类型.将该列更改为"float"数据类型可以为我解决问题.

I had the same error. In my case, one of the columns of the data-frame which I was using was being considered as an 'object' datatype. Changing that column to the 'float' data type solved the problem for me.

这篇关于ValueError:exog没有完整的列排名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆