diff --git a/inst/tests/test_FD_models.R b/inst/tests/test_FD_models.R index 899ce8c..c92e2e1 100644 --- a/inst/tests/test_FD_models.R +++ b/inst/tests/test_FD_models.R @@ -37,9 +37,10 @@ vcovHC(fd_plm2) # vcovHC(fd_pggls) # vcovHC(fd_pggls2) -# vcovXX on FD models +### vcovXX on FD models data("Grunfeld", package = "plm") pGrun <- pdata.frame(Grunfeld) +# one group with only one observation > gets first-differenced away pGrun1 <- pGrun[-c(61:200), ] pGrun1 <- pGrun1[-c(2:20), ] pdim(pGrun1) @@ -49,10 +50,22 @@ vcovHC(mod) vcovBK(mod) diff(pGrun1$inv) +## TODO: pggls errors +# mod.pggls <- pggls(inv ~ value + capital, data = pGrun1, model="fd") + +# one time period with only one observation pGrun2 <- pGrun[-c(21, 41, 61, 81, 101, 121, 141, 161, 181), ] +pdim(pGrun2) +pdim(pGrun2)$Tint mod2 <- plm(inv ~ value + capital, data = pGrun2, model="fd") vcovHC(mod2) + +## TODO vcovBK errors # vcovBK(mod2) # errors with Error in demX[groupinds, , drop = FALSE] : subscript out of bounds + +mod2.pggls <- pggls(inv ~ value + capital, data = pGrun2, model="fd") + + # data with one time period per group -> first-differenced away -> empty model #pGrun3 <- pGrun[c(1, 21, 41, 61, 81, 101, 121, 141, 161, 181), ] diff --git a/inst/tests/test_FD_models.Rout.save b/inst/tests/test_FD_models.Rout.save index 31ea241..09deaf8 100644 --- a/inst/tests/test_FD_models.Rout.save +++ b/inst/tests/test_FD_models.Rout.save @@ -279,9 +279,10 @@ attr(,"cluster") > # vcovHC(fd_pggls) > # vcovHC(fd_pggls2) > -> # vcovXX on FD models +> ### vcovXX on FD models > data("Grunfeld", package = "plm") > pGrun <- pdata.frame(Grunfeld) +> # one group with only one observation > gets first-differenced away > pGrun1 <- pGrun[-c(61:200), ] > pGrun1 <- pGrun1[-c(2:20), ] > pdim(pGrun1) @@ -322,7 +323,24 @@ attr(,"cluster") 3-1947 3-1948 3-1949 3-1950 3-1951 3-1952 3-1953 3-1954 -12.7 -0.9 -48.0 -4.8 41.7 22.1 22.2 10.1 > +> ## TODO: pggls errors +> # mod.pggls <- pggls(inv ~ value + capital, data = pGrun1, model="fd") +> +> # one time period with only one observation > pGrun2 <- pGrun[-c(21, 41, 61, 81, 101, 121, 141, 161, 181), ] +> pdim(pGrun2) +Unbalanced Panel: n = 10, T = 19-20, N = 191 +> pdim(pGrun2)$Tint +$Ti + 1 2 3 4 5 6 7 8 9 10 +20 19 19 19 19 19 19 19 19 19 + +$nt +1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 + 1 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 +1951 1952 1953 1954 + 10 10 10 10 + > mod2 <- plm(inv ~ value + capital, data = pGrun2, model="fd") > vcovHC(mod2) (Intercept) value capital @@ -331,7 +349,13 @@ value 0.02724565 0.0001316189 -0.001260823 capital -0.37044031 -0.0012608229 0.020684253 attr(,"cluster") [1] "group" +> +> ## TODO vcovBK errors > # vcovBK(mod2) # errors with Error in demX[groupinds, , drop = FALSE] : subscript out of bounds +> +> mod2.pggls <- pggls(inv ~ value + capital, data = pGrun2, model="fd") +> +> > > # data with one time period per group -> first-differenced away -> empty model > #pGrun3 <- pGrun[c(1, 21, 41, 61, 81, 101, 121, 141, 161, 181), ] @@ -339,4 +363,4 @@ attr(,"cluster") > > proc.time() user system elapsed - 1.53 0.32 1.81 + 1.59 0.20 1.78