“PanelMatch函数中关于变量class的错误”

huangapple go评论71阅读模式
英文:

Error about variable class in PanelMatch function in R

问题

I cannot reproduce data for privacy reasons. I am just curious if anyone has encountered the same problem since it might be an internal error in the PanelMatch package itself.

我无法因隐私原因再现数据。我只是好奇是否有人遇到了同样的问题,因为这可能是PanelMatch包内部的错误。

I have time.id, unit.id, and treatment all integers; all the covariates and outcome variables are of numeric class. Still, when I run the PanelMatch function, I get this error:

我有time.id、unit.id和treatment这些整数;所有协变量和结果变量都属于数值类别。但是,当我运行PanelMatch函数时,我收到以下错误消息:

Warning: non-numeric data exists. Only numeric (including binary) data can be used for refinement and calculationsError in perform_refinement(lag = lag, time.id = time.id, unit.id = unit.id, :
no viable treated units for att specification

警告:存在非数值数据。只有数值数据(包括二进制数据)可以用于改进和计算。在perform_refinement(lag = lag, time.id = time.id, unit.id = unit.id, :中出现错误
att规范没有可行的受试单位

I know you can't reproduce the error; I'm just curious if anyone has encountered the same error while the variables are as they should be and what might be the reason for the error? Even though the treatment and control groups are unbalanced, in absolute terms, there are more than enough observations in both groups.

我知道你无法重现这个错误,我只是好奇是否有人在变量正确的情况下遇到了相同的错误,以及错误的原因可能是什么?尽管治疗组和对照组在绝对意义上是不平衡的,但两组中有足够多的观察值。

I have converted all the variables into integer and numeric variables, but the problem persists.

我已将所有变量转换为整数和数值变量,但问题仍然存在。

英文:

I cannot reproduce data for privacy reason. I am just curious if anyone has encountered the same problem since it might be internal error in PanelMatch package itself.

I have time.id, unit.id and treatment all integers; all the covariates and outcome variable are of numeric class. Still, when I run PanelMatch function I get this error:

> Warning: non-numeric data exists. Only numeric (including binary) data can be used for refinement and calculationsError in perform_refinement(lag = lag, time.id = time.id, unit.id = unit.id, :
> no viable treated units for att specification

I know you can't reproduce the error, I'm just curious if anyone has encountered the same error while the variables are as they should be and what might be the reason for the error? Even though the treatmetn and control groups are unbalanced, in absolute terms, there are more than enough observations in both groups.

I have converted all the variables into integer and numeric variables, but the problem persists.

答案1

得分: 0

问题似乎出在unit.id变量上。它原本是一个整数变量,但其值之间存在跳跃(1、3、5、8...)。它必须是连续的整数,不能遗漏任何值(1、2、3、4、5...)。最后,我使用了dplyr的match()函数来创建一个新的unit.id变量,其中包含连续的整数。希望这对某人有所帮助。

英文:

The problem seems to be the unit.id variable. It was an integer variable but there were skips between the values (1, 3, 5, 8...). It had to be consecutive integers without omitting values (1,2,3,4,5...). In the end, I used match() function from dplyr to create a new unit.id variable with consecutive integers. Hope this helps someone.

huangapple
  • 本文由 发表于 2023年5月10日 23:04:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/76220009.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定