57710

Missing dimensions

<h3>Question</h3>

I'm a new R user and I'm trying to use panel data (fixed effects) to analyse the effect that several independent variables have on the log of GNI. I'm using the plm package, and this is my code

<pre class="lang-r prettyprint-override">library(plm) head(project_data) Y = cbind(project_data$log_GNI_PPP) X = cbind(project_data$EU_application, project_data$EU_membership, project_data$distance_from_brussels, project_data$Former_USSR_DUMMY, project_data$natural_resources_pct, project_data$secondary_attendence_prct, project_data$eu_education_interaction) project_data_panel = pdata.frame(project_data, index = c("country_name", "year")) plm(Y ~ X, data = project_data_panel, model = "within")

However, when I do this get the error

<blockquote>

Error in class(x) <- setdiff(class(x), "pseries") :
    invalid to set the class to matrix unless the dimension attribute is of length 2 (was 0)

</blockquote>

I'm not sure as this means, as X,Y and project_data_panel all seem to have the correct dimensions (812 x 6) (812 x 1) and (812 x 16) respectively. Can anyone see what I'm doing wrong?

Here's an example of the data

dput(head(project_data, 50)) structure(list(country_name = c("Albania", "Albania", "Albania", "Albania", "Albania", "Albania", "Albania", "Albania", "Albania", "Albania", "Albania", "Albania", "Albania", "Albania", "Albania", "Albania", "Albania", "Albania", "Albania", "Albania", "Albania", "Albania", "Albania", "Albania", "Albania", "Albania", "Albania", "Albania", "Albania", "Armenia", "Armenia", "Armenia", "Armenia", "Armenia", "Armenia", "Armenia", "Armenia", "Armenia", "Armenia", "Armenia", "Armenia", "Armenia", "Armenia", "Armenia", "Armenia", "Armenia", "Armenia", "Armenia", "Armenia", "Armenia"), `Country Code` = c("ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "ALB", "ARM", "ARM", "ARM", "ARM", "ARM", "ARM", "ARM", "ARM", "ARM", "ARM", "ARM", "ARM", "ARM", "ARM", "ARM", "ARM", "ARM", "ARM", "ARM", "ARM", "ARM"), year = c(1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010), EU_application = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), EU_membership = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), distance_from_brussels = c(1589, 1589, 1589, 1589, 1589, 1589, 1589, 1589, 1589, 1589, 1589, 1589, 1589, 1589, 1589, 1589, 1589, 1589, 1589, 1589, 1589, 1589, 1589, 1589, 1589, 1589, 1589, 1589, 1589, 3300, 3300, 3300, 3300, 3300, 3300, 3300, 3300, 3300, 3300, 3300, 3300, 3300, 3300, 3300, 3300, 3300, 3300, 3300, 3300, 3300), GNI_PPP_per_cap = c(2550, 1870, 1730, 2120, 2310, 2710, 3050, 2780, 3110, 3550, 3980, 4460, 4800, 5150, 5560, 5990, 6750, 7480, 8260, 8670, 9530, 10210, 10450, 10750, 11360, 11800, 12060, 12960, 13350, 2340, 2240, 1130, 1190, 1430, 1590, 1790, 1960, 2090, 2200, 2390, 2700, 3140, 3660, 4160, 4970, 5870, 6970, 7700, 6590, 6890), GNI_PPP_GROWTH = c(NA, "-36.36%", "-8.09%", "18.40%", "8.23%", "14.76%", "11.15%", "-9.71%", "10.61%", "12.39%", "10.80%", "10.76%", "7.08%", "6.80%", "7.37%", "7.18%", "11.26%", "9.76%", "9.44%", "4.73%", "9.02%", "6.66%", "2.30%", "2.79%", "5.37%", "3.73%", "2.16%", "6.94%", "2.92%", NA, "-4.27%", "-49.55%", "5.31%", "20.17%", "11.19%", "12.58%", "9.50%", "6.63%", "5.26%", "8.64%", "12.97%", "16.30%", "16.56%", "13.66%", "19.47%", "18.11%", "18.74%", "10.47%", "-14.42%", "4.55%"), Stability_Index = c(NA, NA, NA, NA, NA, 8, 8, 9, 8, 7, 7, 7, 7, 7, 7, 5, 5, 4, 3, 3, 3, 3, 2, 3, 2, 2, 2, 1, 1, NA, NA, NA, NA, NA, 8, 7, 8, 8, 8, 8, 9, 7, 7, 7, 7, 7, 6, 6, 7, 7), Former_USSR_DUMMY = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), `Tertiary_enrollment rate` = c("8.3663600000000002", "8.8553300000000004", "9.2873199999999994", "11.17761", "10.63358", "10.202819999999999", "10.939450000000001", "12.699719999999999", "13.55017", "14.747769999999999", "15.53661", "15.904629999999999", "16.311430000000001", "16.657240000000002", "19.890440000000002", "23.189830000000001", "26.637139999999999", "30.68713", "32.092799999999997", "33.385550000000002", "44.549250000000001", "49.878700000000002", "59.252009999999999", "64.634429999999995", "65.782970000000006", "62.007620000000003", "58.38185", "57.375259999999997", "54.961329999999997", "23.204820000000002", "25.3567", "25.342120000000001", "23.027640000000002", "19.124310000000001", "19.082139999999999", "16.938569999999999", "22.720230000000001", "33.57358", "35.212409999999998", "35.549790000000002", "33.545299999999997", "36.146859999999997", "37.218879999999999", "37.883139999999997", "39.546770000000002", "43.115349999999999", "45.93094", "48.489330000000002", "51.334589999999999", "52.989150000000002" ), `Trade Openess` = c(39.4369634, 36.07052006, 108.7854722, 80.51833277, 53.10258474, 47.61059487, 44.89542726, 45.42552335, 48.13748354, 51.01107175, 63.4540744, 66.49104645, 68.52503792, 67.02060851, 67.04722821, 70.87232827, 74.26708173, 83.20210079, 77.45174863, 75.09481856, 76.54335524, 81.21856394, 76.51020102, 75.87373278, 75.40786559, 71.80103037, 74.80985622, 78.16131198, 77.08240186, 81.33571855, 100.8658552, 101.0767594, 107.9731463, 112.4293646, 86.11485707, 79.22956012, 78.54774505, 71.84245188, 70.56047914, 73.91851927, 71.61719663, 75.94344895, 82.18767117, 75.03721018, 72.03895668, 62.60919306, 58.33644568, 55.70286492, 58.47886987, 66.14730981), natural_resources_pct = c(11.05002975, 9.344824468, 11.41790163, 2.804094484, 1.738143406, 1.28764727, 1.334614417, 1.37003297, 0.304234074, 0.568541328, 1.094738792, 0.732501135, 0.755764016, 0.762078498, 0.776381057, 1.050084705, 1.431007073, 2.171629466, 1.629199242, 0.98009147, 2.033752543, 3.455044143, 3.596119659, 3.578365186, 3.574896619, 1.813210471, 1.049502751, 1.698859222, NA, 0, 0, 0.105584847, 0.102698623, 0.468567478, 0.731881752, 0.511241769, 0.551497144, 0.160976758, 0.141442386, 0.363203884, 0.29675514, 0.460041922, 0.520673274, 0.974003626, 0.901240752, 1.788861711, 1.297061299, 1.294545673, 1.656635559, 2.992128557), Tertiary_enrollment_rate_prop = c(0.0836636, 0.0885533, 0.0928732, 0.1117761, 0.1063358, 0.1020282, 0.1093945, 0.1269972, 0.1355017, 0.1474777, 0.1553661, 0.1590463, 0.1631143, 0.1665724, 0.1989044, 0.2318983, 0.2663714, 0.3068713, 0.320928, 0.3338555, 0.4454925, 0.498787, 0.5925201, 0.6463443, 0.6578297, 0.6200762, 0.5838185, 0.5737526, 0.5496133, 0.2320482, 0.253567, 0.2534212, 0.2302764, 0.1912431, 0.1908214, 0.1693857, 0.2272023, 0.3357358, 0.3521241, 0.3554979, 0.335453, 0.3614686, 0.3721888, 0.3788314, 0.3954677, 0.4311535, 0.4593094, 0.4848933, 0.5133459, 0.5298915), log_GNI_PPP = c(7.84384863815247, 7.53369370984863, 7.45587668749182, 7.65917136766606, 7.74500280351584, 7.90470391387375, 8.02289686960146, 7.93020620668468, 8.04237800517328, 8.17470288246946, 8.28903709827848, 8.40290404501411, 8.47637119689598, 8.54675199365778, 8.62335338724463, 8.6978466911095, 8.81729778386658, 8.91998807096852, 9.01917986651502, 9.06762406977459, 9.16219999664825, 9.23112291115871, 9.25435725739296, 9.28266103355581, 9.33785369227514, 9.37585481045376, 9.39764947028118, 9.46962296990626, 9.4992716638284, 7.75790620835175, 7.71423114484909, 7.02997291170639, 7.08170858610557, 7.26542972325395, 7.37148929521428, 7.4899708988348, 7.58069975222456, 7.64491934495886, 7.69621263934641, 7.77904864492556, 7.90100705199242, 8.0519780789023, 8.20521842639541, 8.33327035325531, 8.51117511909067, 8.67760991282214, 8.84937050375457, 8.94897560784178, 8.79330862749655, 8.8378263640077 ), secondary_attendence_prct = c(90.08174, 90.89363, 77.71476, 70.33512, 68.72906, 68.67849, 67.86755, 69.36618, 71.31361, 71.54467, 71.07808, 72.53716, 72.86855, 75.24344, 74.80221, 77.90939, 79.18955, 82.20059, 84.12509, 85.69499, 88.10389, 89.79816, 92.28983, 96.25608, 97.68487, 97.38848, 95.715, 95.26589, 95.43233, NA, 92.10371, 92.32686, 94.7447, 96.62907, NA, 93.3364, 93.23616, 80.43603, 80.05668, 92.15199, 88.28202, NA, NA, 89.34573, 92.05428, 94.94133, 96.42764, 94.97048, 100.12562, 104.71332)), row.names = c(NA, 50L), class = "data.frame")

Here it is just using head

head(project_data_panel, 50) country_name Country Code year EU_application EU_membership Albania-1990 Albania ALB 1990 0 0 Albania-1991 Albania ALB 1991 0 0 Albania-1992 Albania ALB 1992 0 0 Albania-1993 Albania ALB 1993 0 0 Albania-1994 Albania ALB 1994 0 0 Albania-1995 Albania ALB 1995 0 0 Albania-1996 Albania ALB 1996 0 0 Albania-1997 Albania ALB 1997 0 0 Albania-1998 Albania ALB 1998 0 0 Albania-1999 Albania ALB 1999 0 0 Albania-2000 Albania ALB 2000 0 0 Albania-2001 Albania ALB 2001 0 0 Albania-2002 Albania ALB 2002 0 0 Albania-2003 Albania ALB 2003 0 0 Albania-2004 Albania ALB 2004 0 0 Albania-2005 Albania ALB 2005 0 0 Albania-2006 Albania ALB 2006 0 0 Albania-2007 Albania ALB 2007 0 0 Albania-2008 Albania ALB 2008 0 0 Albania-2009 Albania ALB 2009 1 0 Albania-2010 Albania ALB 2010 1 0 Albania-2011 Albania ALB 2011 1 0 Albania-2012 Albania ALB 2012 1 0 Albania-2013 Albania ALB 2013 1 0 Albania-2014 Albania ALB 2014 1 0 Albania-2015 Albania ALB 2015 1 0 Albania-2016 Albania ALB 2016 1 0 Albania-2017 Albania ALB 2017 1 0 Albania-2018 Albania ALB 2018 1 0 Armenia-1990 Armenia ARM 1990 0 0 Armenia-1991 Armenia ARM 1991 0 0 Armenia-1992 Armenia ARM 1992 0 0 Armenia-1993 Armenia ARM 1993 0 0 Armenia-1994 Armenia ARM 1994 0 0 Armenia-1995 Armenia ARM 1995 0 0 Armenia-1996 Armenia ARM 1996 0 0 Armenia-1997 Armenia ARM 1997 0 0 Armenia-1998 Armenia ARM 1998 0 0 Armenia-1999 Armenia ARM 1999 0 0 Armenia-2000 Armenia ARM 2000 0 0 Armenia-2001 Armenia ARM 2001 0 0 Armenia-2002 Armenia ARM 2002 0 0 Armenia-2003 Armenia ARM 2003 0 0 Armenia-2004 Armenia ARM 2004 0 0 Armenia-2005 Armenia ARM 2005 0 0 Armenia-2006 Armenia ARM 2006 0 0 Armenia-2007 Armenia ARM 2007 0 0 Armenia-2008 Armenia ARM 2008 0 0 Armenia-2009 Armenia ARM 2009 0 0 Armenia-2010 Armenia ARM 2010 0 0 distance_from_brussels GNI_PPP_per_cap GNI_PPP_GROWTH Stability_Index Albania-1990 1589 2550 <NA> NA Albania-1991 1589 1870 -36.36% NA Albania-1992 1589 1730 -8.09% NA Albania-1993 1589 2120 18.40% NA Albania-1994 1589 2310 8.23% NA Albania-1995 1589 2710 14.76% 8 Albania-1996 1589 3050 11.15% 8 Albania-1997 1589 2780 -9.71% 9 Albania-1998 1589 3110 10.61% 8 Albania-1999 1589 3550 12.39% 7 Albania-2000 1589 3980 10.80% 7 Albania-2001 1589 4460 10.76% 7 Albania-2002 1589 4800 7.08% 7 Albania-2003 1589 5150 6.80% 7 Albania-2004 1589 5560 7.37% 7 Albania-2005 1589 5990 7.18% 5 Albania-2006 1589 6750 11.26% 5 Albania-2007 1589 7480 9.76% 4 Albania-2008 1589 8260 9.44% 3 Albania-2009 1589 8670 4.73% 3 Albania-2010 1589 9530 9.02% 3 Albania-2011 1589 10210 6.66% 3 Albania-2012 1589 10450 2.30% 2 Albania-2013 1589 10750 2.79% 3 Albania-2014 1589 11360 5.37% 2 Albania-2015 1589 11800 3.73% 2 Albania-2016 1589 12060 2.16% 2 Albania-2017 1589 12960 6.94% 1 Albania-2018 1589 13350 2.92% 1 Armenia-1990 3300 2340 <NA> NA Armenia-1991 3300 2240 -4.27% NA Armenia-1992 3300 1130 -49.55% NA Armenia-1993 3300 1190 5.31% NA Armenia-1994 3300 1430 20.17% NA Armenia-1995 3300 1590 11.19% 8 Armenia-1996 3300 1790 12.58% 7 Armenia-1997 3300 1960 9.50% 8 Armenia-1998 3300 2090 6.63% 8 Armenia-1999 3300 2200 5.26% 8 Armenia-2000 3300 2390 8.64% 8 Armenia-2001 3300 2700 12.97% 9 Armenia-2002 3300 3140 16.30% 7 Armenia-2003 3300 3660 16.56% 7 Armenia-2004 3300 4160 13.66% 7 Armenia-2005 3300 4970 19.47% 7 Armenia-2006 3300 5870 18.11% 7 Armenia-2007 3300 6970 18.74% 6 Armenia-2008 3300 7700 10.47% 6 Armenia-2009 3300 6590 -14.42% 7 Armenia-2010 3300 6890 4.55% 7 Former_USSR_DUMMY Tertiary_enrollment rate Trade Openess Albania-1990 0 8.3663600000000002 39.43696 Albania-1991 0 8.8553300000000004 36.07052 Albania-1992 0 9.2873199999999994 108.78547 Albania-1993 0 11.17761 80.51833 Albania-1994 0 10.63358 53.10258 Albania-1995 0 10.202819999999999 47.61059 Albania-1996 0 10.939450000000001 44.89543 Albania-1997 0 12.699719999999999 45.42552 Albania-1998 0 13.55017 48.13748 Albania-1999 0 14.747769999999999 51.01107 Albania-2000 0 15.53661 63.45407 Albania-2001 0 15.904629999999999 66.49105 Albania-2002 0 16.311430000000001 68.52504 Albania-2003 0 16.657240000000002 67.02061 Albania-2004 0 19.890440000000002 67.04723 Albania-2005 0 23.189830000000001 70.87233 Albania-2006 0 26.637139999999999 74.26708 Albania-2007 0 30.68713 83.20210 Albania-2008 0 32.092799999999997 77.45175 Albania-2009 0 33.385550000000002 75.09482 Albania-2010 0 44.549250000000001 76.54336 Albania-2011 0 49.878700000000002 81.21856 Albania-2012 0 59.252009999999999 76.51020 Albania-2013 0 64.634429999999995 75.87373 Albania-2014 0 65.782970000000006 75.40787 Albania-2015 0 62.007620000000003 71.80103 Albania-2016 0 58.38185 74.80986 Albania-2017 0 57.375259999999997 78.16131 Albania-2018 0 54.961329999999997 77.08240 Armenia-1990 1 23.204820000000002 81.33572 Armenia-1991 1 25.3567 100.86586 Armenia-1992 1 25.342120000000001 101.07676 Armenia-1993 1 23.027640000000002 107.97315 Armenia-1994 1 19.124310000000001 112.42936 Armenia-1995 1 19.082139999999999 86.11486 Armenia-1996 1 16.938569999999999 79.22956 Armenia-1997 1 22.720230000000001 78.54775 Armenia-1998 1 33.57358 71.84245 Armenia-1999 1 35.212409999999998 70.56048 Armenia-2000 1 35.549790000000002 73.91852 Armenia-2001 1 33.545299999999997 71.61720 Armenia-2002 1 36.146859999999997 75.94345 Armenia-2003 1 37.218879999999999 82.18767 Armenia-2004 1 37.883139999999997 75.03721 Armenia-2005 1 39.546770000000002 72.03896 Armenia-2006 1 43.115349999999999 62.60919 Armenia-2007 1 45.93094 58.33645 Armenia-2008 1 48.489330000000002 55.70286 Armenia-2009 1 51.334589999999999 58.47887 Armenia-2010 1 52.989150000000002 66.14731 natural_resources_pct Tertiary_enrollment_rate_prop log_GNI_PPP Albania-1990 11.0500298 0.0836636 7.843849 Albania-1991 9.3448245 0.0885533 7.533694 Albania-1992 11.4179016 0.0928732 7.455877 Albania-1993 2.8040945 0.1117761 7.659171 Albania-1994 1.7381434 0.1063358 7.745003 Albania-1995 1.2876473 0.1020282 7.904704 Albania-1996 1.3346144 0.1093945 8.022897 Albania-1997 1.3700330 0.1269972 7.930206 Albania-1998 0.3042341 0.1355017 8.042378 Albania-1999 0.5685413 0.1474777 8.174703 Albania-2000 1.0947388 0.1553661 8.289037 Albania-2001 0.7325011 0.1590463 8.402904 Albania-2002 0.7557640 0.1631143 8.476371 Albania-2003 0.7620785 0.1665724 8.546752 Albania-2004 0.7763811 0.1989044 8.623353 Albania-2005 1.0500847 0.2318983 8.697847 Albania-2006 1.4310071 0.2663714 8.817298 Albania-2007 2.1716295 0.3068713 8.919988 Albania-2008 1.6291992 0.3209280 9.019180 Albania-2009 0.9800915 0.3338555 9.067624 Albania-2010 2.0337525 0.4454925 9.162200 Albania-2011 3.4550441 0.4987870 9.231123 Albania-2012 3.5961197 0.5925201 9.254357 Albania-2013 3.5783652 0.6463443 9.282661 Albania-2014 3.5748966 0.6578297 9.337854 Albania-2015 1.8132105 0.6200762 9.375855 Albania-2016 1.0495028 0.5838185 9.397649 Albania-2017 1.6988592 0.5737526 9.469623 Albania-2018 NA 0.5496133 9.499272 Armenia-1990 0.0000000 0.2320482 7.757906 Armenia-1991 0.0000000 0.2535670 7.714231 Armenia-1992 0.1055848 0.2534212 7.029973 Armenia-1993 0.1026986 0.2302764 7.081709 Armenia-1994 0.4685675 0.1912431 7.265430 Armenia-1995 0.7318818 0.1908214 7.371489 Armenia-1996 0.5112418 0.1693857 7.489971 Armenia-1997 0.5514971 0.2272023 7.580700 Armenia-1998 0.1609768 0.3357358 7.644919 Armenia-1999 0.1414424 0.3521241 7.696213 Armenia-2000 0.3632039 0.3554979 7.779049 Armenia-2001 0.2967551 0.3354530 7.901007 Armenia-2002 0.4600419 0.3614686 8.051978 Armenia-2003 0.5206733 0.3721888 8.205218 Armenia-2004 0.9740036 0.3788314 8.333270 Armenia-2005 0.9012408 0.3954677 8.511175 Armenia-2006 1.7888617 0.4311535 8.677610 Armenia-2007 1.2970613 0.4593094 8.849371 Armenia-2008 1.2945457 0.4848933 8.948976 Armenia-2009 1.6566356 0.5133459 8.793309 Armenia-2010 2.9921286 0.5298915 8.837826 secondary_attendence_prct Albania-1990 90.08174 Albania-1991 90.89363 Albania-1992 77.71476 Albania-1993 70.33512 Albania-1994 68.72906 Albania-1995 68.67849 Albania-1996 67.86755 Albania-1997 69.36618 Albania-1998 71.31361 Albania-1999 71.54467 Albania-2000 71.07808 Albania-2001 72.53716 Albania-2002 72.86855 Albania-2003 75.24344 Albania-2004 74.80221 Albania-2005 77.90939 Albania-2006 79.18955 Albania-2007 82.20059 Albania-2008 84.12509 Albania-2009 85.69499 Albania-2010 88.10389 Albania-2011 89.79816 Albania-2012 92.28983 Albania-2013 96.25608 Albania-2014 97.68487 Albania-2015 97.38848 Albania-2016 95.71500 Albania-2017 95.26589 Albania-2018 95.43233 Armenia-1990 NA Armenia-1991 92.10371 Armenia-1992 92.32686 Armenia-1993 94.74470 Armenia-1994 96.62907 Armenia-1995 NA Armenia-1996 93.33640 Armenia-1997 93.23616 Armenia-1998 80.43603 Armenia-1999 80.05668 Armenia-2000 92.15199 Armenia-2001 88.28202 Armenia-2002 NA Armenia-2003 NA Armenia-2004 89.34573 Armenia-2005 92.05428 Armenia-2006 94.94133 Armenia-2007 96.42764 Armenia-2008 94.97048 Armenia-2009 100.12562 Armenia-2010 104.71332

and this is my session info

R version 3.6.2 (2019-12-12) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 18363) Matrix products: default locale: [1] LC_COLLATE=English_Ireland.1252 LC_CTYPE=English_Ireland.1252 [3] LC_MONETARY=English_Ireland.1252 LC_NUMERIC=C [5] LC_TIME=English_Ireland.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] plm_2.2-3 loaded via a namespace (and not attached): [1] Rcpp_1.0.3 pillar_1.4.3 compiler_3.6.2 miscTools_0.6-26 bitops_1.0-6 [6] tools_3.6.2 testthat_2.3.1 digest_0.6.23 nlme_3.1-142 lattice_0.20-38 [11] lifecycle_0.1.0 tibble_2.1.3 gtable_0.3.0 pkgconfig_2.0.3 rlang_0.4.5 [16] bibtex_0.4.2.2 rstudioapi_0.10 maxLik_1.3-8 swirl_2.4.5 yaml_2.2.0 [21] dplyr_0.8.4 httr_1.4.1 stringr_1.4.0 lmtest_0.9-37 gbRd_0.4-11 [26] grid_3.6.2 tidyselect_1.0.0 glue_1.3.1 R6_2.4.1 bdsmatrix_1.3-4 [31] Rdpack_0.11-1 Formula_1.2-3 ggplot2_3.2.1 purrr_0.3.3 magrittr_1.5 [36] scales_1.1.0 MASS_7.3-51.4 assertthat_0.2.1 colorspace_1.4-1 sandwich_2.5-1 [41] stringi_1.4.6 RCurl_1.98-1.1 lazyeval_0.2.2 munsell_0.5.0 crayon_1.3.4 [46] zoo_1.8-7 >
<h3>Answer1:</h3>

plm() is expecting a pdata.frame. Your call

plm(Y ~ X, data = project_data_panel, model = "within")

mixes matrices (Y and X) with pdata.frame (project_data_panel). The correct syntax is

plm(log_GNI_PPP ~  EU_application + EU_membership + distance_from_brussels + Former_USSR_DUMMY + natural_resources_pct + secondary_attendence_prct + eu_education_interaction, data = project_data_panel, model = "within")

You still need to check that project_data_panel has all of the required variables. At least variable called eu_education_interaction is missing from the data you included.

来源:https://stackoverflow.com/questions/61658605/missing-dimensions

Recommend