1

在运行以下代码行时:

Pfit1 = plm(hits ~ countDir, data = Pdf1, model = "within" , effect = "twoways")

我收到以下错误:

Error in x[, ii] : subscript out of bounds

但是,我不知道从这里去哪里,因为基于这个错误我无法发现这里出了什么问题。

数据框:

dput(Pfit1)

结构(列表(点击= c(2L,5L,1L,1L,30L,11L,10L,17L,29L,100L,80L,36L,24L,15L,18L,16L,16L,13L,11L,6L,8L, 9L, 8L, 8L, 9L, 9L, 5L, 13L, 10L, 14L, 7L, 13L, 18L, 13L, 13L, 17L, 23L, 79L, 66L, 41L, 53L, 40L, 53L, 26L, 20L, 25L, 22L, 15L, 14L, 10L, 15L, 21L, 14L, 11L, 14L, 9L, 9L, 8L, 11L, 8L, 11L, 15L, 9L, 5L, 8L, 5L, 6L, 5L, 8L, 3L, 3L, 3L, 3L, 4L, 8L, 4L, 4L, 6L, 20L, 9L, 6L, 5L, 5L, 5L, 4L, 4L, 4L, 4L, 3L, 4L, 5L, 4L, 4L, 5L, 12L, 12L, 9L, 20L, 77L, 53L, 77L, 91L, 80L, 73L, 74L, 81L, 65L, 55L, 56L, 54L, 51L, 45L, 47L, 47L, 48L, 100L, 72L, 84L, 97L, 72L, 55L, 46L, 40L, 39L, 34L, 35L, 26L, 24L, 24L, 20L, 20L, 21L, 19L, 19L, 19L, 16L, 19L, 18L), countDir = c(492, 492, 492, 492, 492, 492 , 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492 , 492, 492,492、492、492、492、492、492、492、492、492、492、492、492、492、492、492、492、492、492、492、492、492、492、492、492、492、 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, 417, 417、417、417、417、417、417、417、417、417、417、417、417、417、417、417、417、417、417、417、417、417、417、417、417、417、 417、417、417、417、417、417、417、417、417、417、417、417、417、417、417、417、417、417、417、417、417、417、417、417、417、 417, 417, 417, 417, 417), countAct = c(68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68 , 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68 , 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68 , 68, 354, 354, 354, 354, 354, 354,354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354), ReleaseBetween = c(2, 2, 2, 2, 2, 2, 2, 2, 2, 2 , 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 , 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 , 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 , 1, 1, 1), 类型 = 结构 (c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2升,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L, 2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("传记", "戏剧"), class = "factor"), year = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L4, 2, 2, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,,2014L,,,,,地2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2014L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,,2008L,,2008L,,2008L,,,,,,地2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,,2008L,,2008L,,2008L,,2008L,,2008L,,2008L,,2008L,,2008L,,2008L,,2008L,,2008L,,,,,地,,地2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,2008L,,2008L,,2008L,,2008L,,2008L,,2008L,,2008L,,2008L,,2008L,,2008L,,2008L,,2008L,,,,,地,,地2008L, 2008L), 周期 = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3 , 3, 3,3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3)), .Names = c("hits", "countDir", "countAct", " ReleaseBetween", "Genre", "year", "period"), class = c("pdata.frame", "data.frame"), row.names = c("Adieu au langage--9", "Adieu au langage--8”, “Adieu au langage--7”, “Adieu au langage--6”, “Adieu au langage--5”, “Adieu au langage--4”, “Adieu au langage--3” ", "再见了语言--2”、“再见了语言--1”、“再见了语言-0”、“再见了语言-1”、“再见了语言-2”、“再见了语言-3”、“ Adieu au langage-4”、“Adieu au langage-5”、“Adieu au langage-6”、“Adieu au langage-7”、“Adieu au langage-8”、“Adieu au langage-9”、“Adieu au langage-10”、“Adieu au langage-11”、“Adieu au langage-12”、“Adieu au langage-13”、“Adieu au langage-14”、“Adieu au langage-15”、“Adieu au langage- 16”、“再见 17 种语言”、“再见 18 种语言”、“再见 19 种语言”、“再见 20 种语言”、“再见 21 种语言”、“再见 22 种语言” , "Adieu au langage-23", "Adieu au langage-24”, “Adieu au langage-25”, “Adieu au langage-26”, “Adieu au langage-27”, “Adieu au langage-28”, “Adieu au langage-29”, “Adieu au langage-30”、“再见 au langage-31”、“再见 32 ”、“再见 33”、“再见 34”、“再见 35”、“再见 lang-” 36”、“再见 37 种语言”、“再见 38 种语言”、“再见 39 种语言”、“再见 40 种语言”、“再见 41 种语言”、“再见 42 种语言” , "Adieu au langage-43", "Adieu au langage-44", "Adieu au langage-45", "Adieu au langage-46", "Adieu au langage-47", "Adieu au langage-48", "再见 au langage-49","Adieu au langage-50", "Adieu au langage-51", "Adieu au langage-52", "Adieu au langage-53", "Adieu au langage-54", "Adieu au langage-55", "Adieu au langage-56”、“Adieu au langage-57”、“Adieu au langage-58”、“Adieu au langage-59”、“Changeling--9”、“Changeling--8”、“Changeling--7” , “变身--6”, “变身--5”, “变身--4”, “变身--3”, “变身--2”, “变身--1”, “变身--0”, “ Changeling-1”、“Changeling-2”、“Changeling-3”、“Changeling-4”、“Changeling-5”、“Changeling-6”、“Changeling-7”、“Changeling-8”、“Changeling- 9", "Changeling-10”、“Changeling-11”、“Changeling-12”、“Changeling-13”、“Changeling-14”、“Changeling-15”、“Changeling-16”、“Changeling-17”、“Changeling- 18"、"Changeling-19"、"Changeling-20"、"Changeling-21"、"Changeling-22"、"Changeling-23"、"Changeling-24"、"Changeling-25"、"Changeling-26" , “Changeling-27”, “Changeling-28”, “Changeling-29”, “Changeling-30”, “Changeling-31”, “Changeling-32”, “Changeling-33”, “Changeling-34”, “变形金刚 35"、"变形金刚 36"、"变形金刚 37"、"变形金刚 38"、"变形金刚 39"、"变形金刚 40"、"Changeling-41”、“Changeling-42”、“Changeling-43”、“Changeling-44”、“Changeling-45”、“Changeling-46”、“Changeling-47”、“Changeling-48”、“Changeling- 49", "Changeling-50", "Changeling-51", "Changeling-52", "Changeling-53", "Changeling-54", "Changeling-55", "Changeling-56", "Changeling-57" , "Changeling-58", "Changeling-59"), index = structure(list(keyword = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L, 2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L,2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("Adieu au langage", "Changeling"), class = "factor" ), 日期 = 结构 (c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 50L, 51L, 52L, 53L, 54L, 55L, 56L, 57L, 58L, 59L, 60L, 61L, 62L, 63L, 64L, 65L, 66L, 67L, 68L, 69L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L,30L, 31L, 32L, 33L, 34L, 35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 50L, 51L, 52L, 53L, 54L, 55L, 56L, 57L, 58L, 59L, 60L, 61L, 62L, 63L, 64L, 65L, 66L, 67L, 68L, 69L), .Label = c("-9", "-8", "-7" 、“-6”、“-5”、“-4”、“-3”、“-2”、“-1”、“0”、“1”、“2”、“3”、“4” 、“5”、“6”、“7”、“8”、“9”、“10”、“11”、“12”、“13”、“14”、“15”、“16”、“ 17”、“18”、“19”、“20”、“21”、“22”、“23”、“24”、“25”、“26”、“27”、“28”、“29” , "30", "31”、“32”、“33”、“34”、“35”、“36”、“37”、“38”、“39”、“40”、“41”、“42”、“43” 、“44”、“45”、“46”、“47”、“48”、“49”、“50”、“51”、“52”、“53”、“54”、“55”、“ 56", "57", "58", "59"), class = "factor")), .Names = c("keyword", "date"), class = c("pindex", "data.frame "), row.names = c(“110101”, “210101”, “310101”, “410101”, “510101”, “610101”, “71681”, “81681”, “91681”, “101681”, “ 112071", "121841", "131711、“141681”、“151681”、“161681”、“171681”、“181681”、“191681”、“201681”、“212081”、“221841”、“231711”、“241681”、“251681” , “261681”, “271681”, “281681”, “291681”, “301681”, “312071”, “321841”, “331711”, “341681”, “351681”, “361681”, “371681”, “ 381681”、“391681”、“401681”、“412071”、“421841”、“431711”、“441681”、“451681”、“461681”、“471681”、“481681”、“491681”、“501681” , "512071", "521841", "531711", "541681", "551681",“561681”、“571681”、“581681”、“591681”、“601681”、“612071”、“621841”、“631711”、“641681”、“651681”、“661681”、“671681”、“681681” ”、“691681”、“12031”、“22031”、“32031”、“42031”、“52031”、“62031”、“7641”、“8641”、“9641”、“10641”、“111031”、 “12661”、“13641”、“14641”、“15641”、“16641”、“17641”、“18641”、“19641”、“20641”、“211041”、“22661”、“23641”、“24641” ”、“25641”、“26641”、“27641”、“28641”、“29641”、“30641”、“311031”、“32661”、“33641”、“34641”、“35641”、“36641”、“37641”、“38641”、“39641”、“40641”、“411031”、“42661”、“43641” ”、“44641”、“45641”、“46641”、“47641”、“48641”、“49641”、“50641”、“511031”、“52661”、“53641”、“54641”、“55641”、 “56641”、“57641”、“58641”、“59641”、“60641”、“611031”、“62661”、“63641”、“64641”、“65641”、“66641”、“67641”、“68641” ", "69641")))36641、37641、38641、39641、40641、411031、42661、43641、44641、45641、46641、47641、48641 , “49641”, “50641”, “511031”, “52661”, “53641”, “54641”, “55641”, “56641”, “57641”, “58641”, “59641”, “60641”, “ 611031”、“62661”、“63641”、“64641”、“65641”、“66641”、“67641”、“68641”、“69641”)))36641、37641、38641、39641、40641、411031、42661、43641、44641、45641、46641、47641、48641 , “49641”, “50641”, “511031”, “52661”, “53641”, “54641”, “55641”, “56641”, “57641”, “58641”, “59641”, “60641”, “ 611031”、“62661”、“63641”、“64641”、“65641”、“66641”、“67641”、“68641”、“69641”)))47641、“48641”、“49641”、“50641”、“511031”、“52661”、“53641”、“54641”、“55641”、“56641”、“57641”、“58641”、“59641” , “60641”, “611031”, “62661”, “63641”, “64641”, “65641”, “66641”, “67641”, “68641”, “69641”)))47641、“48641”、“49641”、“50641”、“511031”、“52661”、“53641”、“54641”、“55641”、“56641”、“57641”、“58641”、“59641” , “60641”, “611031”, “62661”, “63641”, “64641”, “65641”, “66641”, “67641”, “68641”, “69641”)))69641")))69641")))

4

1 回答 1

1

这是特定于您的数据/统计问题的:您的变量中没有每个人的时间变化countDir,因此,您的内部模型是不可估计的。

你可以运行pvar(Pdf1)看看:

no time variation:       countDir countAct ReleaseBetween Genre year 
no individual variation: period

不过,plm 的错误消息可以改进。

于 2017-04-30T09:10:30.210 回答