| pdata.frame {plm} | R Documentation |
a data.frame with further attributes usefull for panel data
x <- pdata.frame(x,id,time=NULL)
x |
a data.frame |
id |
the individual index |
time |
the time index |
The observations are assumed to be sorted by individuals first and by
time observations. id and time can be the names of the
indexes contained in the data.frame if any. time may be
ommited, in this case a new variable called "time" is added to
the data.frame. For balanced pannels, the argument id can
be an integer. In this case, two new variables, "time" and
"id" are added to the data.frame.
pdata.frame calls pdim to check for the individual and
time dimensions of the panel and pvarcheck to check for the
individual and time variation of each variable.
pdata.frame adds an attribute "data" to each variable in
the data.frame. This can be usefull to use simply the special
panel operators in model formulas. This works properly if the result of
the pdata.frame is stored in an object of the same name as its
data.frame argument.
The print method is inheritaded from data.frame. A
summary method is provided which add to the
summary.data.frame method informations about the structure of the panel.
An object of class c("pdata.frame","data.frame"), which is a
data.frame with an additional attribute panel. This
attribute is a list containing :
indexes |
a list containing the names of the
individual (id) and time (time) index variables, |
nT |
a list containing the number of individuals (n), of time
observations (T) and of total observations (N), |
balanced |
TRUE for a balanced panel, |
Tint |
a list of two vectors containing the number of time observation for
each individual (Ti) and the number of individual observation for each
time observation (nt), |
panel.names |
a list of two character vectors containing the
labels of the individuals (id.names) and of the time
observations (time.names), |
dim.var |
a list of two logical vectors indicating wheter each
variable presents variations accross individuals (id.var) and
accross time periods (time.var). |
These attributes may be extracted using synonimus functions.
library(Ecdat) #There are 595 individuals data(Wages) Wages <- pdata.frame(Wages,595) # Gasoline contains two variables which are individual and time indexes data(Gasoline) Gasoline <- pdata.frame(Gasoline,country,year) summary(Gasoline) # Hedonic is an unbalanced panel, townid is the individual index data(Hedonic) Hedonic=pdata.frame(Hedonic,townid)