我是初学者,使用R studio进行入门计量经济学课程。我正在使用包含面板数据的Ecdat数据集,我想进行多元回归,然后对个人和时间使用固定效果。每当我尝试使用plm包的固定效果函数时,我都会收到以下错误消息:
Error in `row.names<-.data.frame`(`*tmp*`, value = c("X1.2", "X1.3", "X1.4", :
duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique values when setting 'row.names':
‘X1’, ‘X1.1’, ‘X1.2’, ‘X1.3’, ‘X1.4’, ‘X1.5’, ‘X1.6’,
‘X2’, ‘X2.1’, ‘X2.2’, ‘X2.3’, ‘X2.4’, ‘X2.5’, ‘X2.6’,
‘X3’, ‘X3.1’, ‘X3.2’, ‘X3.3’, ‘X3.4’, ‘X3.5’, ‘X3.6’,
‘X4’, ‘X4.1’, ‘X4.2’, ‘X4.3’, ‘X4.4’, ‘X4.5’, ‘X4.6’,
‘X5’, ‘X5.1’, ‘X5.2’, ‘X5.3’, ‘X5.4’, ‘X5.5’, ‘X5.6’,
‘X6’, ‘X6.1’, ‘X6.2’, ‘X6.3’, ‘X6.4’, ‘X6.5’, ‘X6.6’,
‘X7’, ‘X7.1’, ‘X7.2’, ‘X7.3’, ‘X7.4’, ‘X7.5’, ‘X7.6’, ‘X8’
我在不同的论坛上环顾四周试图找到一种方法,在设置行的名称时使值唯一,但到目前为止我还没有取得任何成功。这是我到目前为止所做的:
#in order to get the id and time for the data from Ecdat
Wages <- plm.data(Wages, index = 595)
#in order to try to make the row names unique
rownames(Wages) <- make.names(Wages[,1], unique = TRUE)
我还创造了以下假人:
allwage <- Wages$lwage
skin <- Wages$black
edu <- Wages$ed
years <- Wages$exp
然后我尝试在以下回归中使用固定效果:
theFEline <- plm(allwage ~ skin, + edu + years, data = Wages,
index = c("id","time"), model="within")
那是我收到错误消息的时候。
我对我正在做的事情的想法非常有限,甚至不知道下一步该做什么。任何帮助都将非常感激。
的Björn
答案 0 :(得分:0)
希望这有帮助!
extension UIImage {
func outline() -> UIImage? {
UIGraphicsBeginImageContext(size)
let rect = CGRect(x: 0, y: 0, width: size.width, height: size.height)
self.draw(in: rect, blendMode: .normal, alpha: 1.0)
let context = UIGraphicsGetCurrentContext()
context?.setStrokeColor(red: 1.0, green: 0.5, blue: 1.0, alpha: 1.0)
context?.setLineWidth(5.0)
context?.stroke(rect)
let newImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return newImage
}
}