[R] plm(): observations not used for modelling

David Winsemius dwinsemius at comcast.net
Tue Nov 6 19:59:11 CET 2012


On Nov 6, 2012, at 7:55 AM, Daniel Bab. wrote:

> Hello,
> 
> I have posted this problem before, but thought I try to explain it a bit
> better.
> I'm using the function plm to create a fixed effects model for panel data,
> my method is therefor "within" my effect is "twoways".
> My Data contains unbalanced Panels due to missing Values, but contains 309
> observation for 11 variables (incl. response), with no missing Values. These
> 309 observations distribute over 25 individuals and 18 years.
> The fuction plm only uses 286 of these observations (also if the model is
> changed to first differences and the effect to individual) and omits 23
> observations due to na.action, but in my dataset they do not contain NAs.
> Is this due to the Transformation used in the plm function?
> 
> If it is of any help, these are the observations that are omitted (which
> obviously don't contain NAs):
> 
>    TIME                                                       GEO
> 98  1993 Deutschland (einschließlich der ehemaligen DDR seit 1991)
> 99  1994 Deutschland (einschließlich der ehemaligen DDR seit 1991)
> 100 1995 Deutschland (einschließlich der ehemaligen DDR seit 1991)
> 101 1996 Deutschland (einschließlich der ehemaligen DDR seit 1991)
> 370 1999                                                Österreich
> 372 2001                                                Österreich
> 375 2004                                                Österreich
> 385 1995                                                     Polen
> 386 1996                                                     Polen
> 387 1997                                                     Polen
> 495 1991                                                  Schweden
> 439 1992                                                 Slowenien
> 440 1993                                                 Slowenien
> 441 1994                                                 Slowenien
> 442 1995                                                 Slowenien
> 443 1996                                                 Slowenien
> 172 1991                                                   Spanien
> 173 1992                                                   Spanien
> 174 1993                                                   Spanien
> 175 1994                                                   Spanien
> 176 1995                                                   Spanien
> 177 1996                                                   Spanien
> 178 1997                                                   Spanien
>    Verkehrstote_Quote Autobahnlaenge_Quote PKW_Quote$Value LKW$Value

I was surprised to a "$" in a variable name. Are you sure that is not the source of your problems?

> dat <- data.frame(a$b = 1:3, d=1:3)
Error: unexpected '=' in "dat <- data.frame(a$b ="

I would not expect the internal parsing routines to necessarily properly handle invalid column names.

-- 
David.
> 98                 123         0.0310283316             479  19.62343
> 99                 121         0.0312047562             489  25.99028
> 100                116         0.0313363746             496  27.16505
> 101                107         0.0314931965             501  27.78134
> 370                135         0.0194823002             502  39.96261
> 372                119         0.0196134540             521  41.26695
> 375                108         0.0199949923             505  40.89616
> 385                179         0.0007867343             195  33.66977
> 386                165         0.0008251115             209  35.50949
> 387                189         0.0008443002             221  36.80187
> 495                 87         0.0021512832             421  31.19678
> 439                247         0.0125413519             304  16.00871
> 440                247         0.0132326075             317  17.05044
> 441                254         0.0136769861             330  18.09584
> 442                209         0.0144669925             351  20.10579
> 443                195         0.0153063744             366  21.10271
> 172                227         0.0103736290             322 110.86938
> 173                200         0.0128525994             336  67.96822
> 174                163         0.0130329241             343  69.89171
> 175                143         0.0128743969             350  72.00581
> 176                146         0.0137958367             361  74.65096
> 177                139         0.0144557065             374  77.52797
> 178                142         0.0153573304             387  81.11232
>    Motorraeder$Value Bevoelkerungsquote Quote_Jung Quote_Alt
> 98          19.561682          226.76063   12.31254  3.928754
> 99          23.297817          227.77846   11.82362  4.011330
> 100         27.802782          228.33996   11.40332  4.087582
> 101         30.189141          229.12098   11.19176  4.026278
> 370         32.947233           95.17546   11.98196  3.378319
> 372         36.778704           95.63432   11.90409  3.558421
> 375         38.808372           97.08449   12.20926  4.066773
> 385         24.079461          123.38487   15.48095  2.154967
> 386         22.688776          123.47698   15.82873  2.102519
> 387         21.791262          123.57274   16.09662  2.027340
> 495          5.238265           19.09182   13.55292  4.302106
> 439          5.502994           98.69708   14.60535  2.364486
> 440          5.516317           98.45870   14.58509  2.464340
> 441          4.523959           98.22782   14.64697  2.535880
> 442          4.523802           98.23123   14.74327  2.612043
> 443          4.019563           98.27018   14.93248  2.567195
> 172         30.199689           77.03350   16.89450  2.962978
> 173         32.074025           77.28903   16.86363  3.062267
> 174         32.684277           77.54355   16.80052  3.163572
> 175         32.817935           77.77117   16.69243  3.261328
> 176         33.068060           77.96193   16.53155  3.352908
> 177         33.171926           78.13598   16.31481  3.438006
> 178         33.548015           78.32325   16.02780  3.510471
>    Quote_Erstzulassungen BIP$Value Alkohol.Wert
> 98             0.09782568     21100        13.50
> 99             0.08070474     22200        13.37
> 100            0.08202309     23600        13.35
> 101            0.08530314     23400        13.12
> 370            0.07834963     24900        13.40
> 372            0.07018843     26600        12.80
> 375            0.07575858     28700        12.50
> 385            0.05996661      2800         8.14
> 386            0.07789285      3200         8.08
> 387            0.08464139      3600         8.64
> 495            0.05298563     24200         6.28
> 439            0.05147030      4800        13.64
> 440            0.09212000      5400        14.31
> 441            0.07068413      6100        13.38
> 442            0.08677918      8100        13.36
> 443            0.07988964      8400        12.04
> 172            0.07290907     11400        13.23
> 173            0.07695772     11800        12.50
> 174            0.05522833     10800        12.03
> 175            0.06836836     10800        11.70
> 176            0.06125084     11600        11.38
> 177            0.06563393     12400        11.07
> 178            0.07133359     12800        11.95
> 
> TIME and GEO are the Index of my Paneldata, "Verkehrstoten_Quote" is the
> dependent, all others the independent variables.
> If anyone could help me understand, why these observations (or generally
> any) are left out, I would be very glad.
> 
> Thank you for dealing with my Problem.
> Regards,
> Daniel
> 
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/plm-observations-not-used-for-modelling-tp4648571.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
Alameda, CA, USA




More information about the R-help mailing list