This function checks the number of individuals and time observations in the panel and whether it is balanced or not.
pdim(x, ...)
# Default S3 method
pdim(x, y, ...)
# S3 method for class 'data.frame'
pdim(x, index = NULL, ...)
# S3 method for class 'pdata.frame'
pdim(x, ...)
# S3 method for class 'pseries'
pdim(x, ...)
# S3 method for class 'pggls'
pdim(x, ...)
# S3 method for class 'pcce'
pdim(x, ...)
# S3 method for class 'pmg'
pdim(x, ...)
# S3 method for class 'pgmm'
pdim(x, ...)
# S3 method for class 'panelmodel'
pdim(x, ...)
# S3 method for class 'pdim'
print(x, ...)a data.frame, a pdata.frame, a pseries, a
panelmodel, or a pgmm object,
further arguments.
a vector,
see pdata.frame(),
An object of class pdim containing the following
elements:
a list containing n, the number of individuals, T,
the number of time observations, N the total number of
observations,
a list containing two vectors (of type integer): Ti
gives the number of observations for each individual and nt gives
the number of individuals observed for each period,
a logical value: TRUE for a balanced panel,
FALSE for an unbalanced panel,
a list of character vectors: id.names contains
the names of each individual and time.names contains the names of
each period.
pdim is called by the estimation functions and can be also used
stand-alone.
Calling pdim on an estimated panelmodel object
and on the corresponding (p)data.frame used for this
estimation does not necessarily yield the same result. When
called on an estimated panelmodel, the number of
observations (individual, time) actually used for model
estimation are taken into account. When called on a
(p)data.frame, the rows in the (p)data.frame are
considered, disregarding any NA values in the dependent or
independent variable(s) which would be dropped during model
estimation.
is.pbalanced() to just determine balancedness
of data (slightly faster than pdim),punbalancedness() for measures of
unbalancedness,nobs(),
pdata.frame(),pvar() to check for
each variable if it varies cross-sectionally and over time.
# There are 595 individuals
data("Wages", package = "plm")
pdim(Wages, 595)
#> Balanced Panel: n = 595, T = 7, N = 4165
# Gasoline contains two variables which are individual and time
# indexes and are the first two variables
data("Gasoline", package="plm")
pdim(Gasoline)
#> Balanced Panel: n = 18, T = 19, N = 342
# Hedonic is an unbalanced panel, townid is the individual index
data("Hedonic", package = "plm")
pdim(Hedonic, "townid")
#> Unbalanced Panel: n = 92, T = 1-30, N = 506
# An example of the panelmodel method
data("Produc", package = "plm")
z <- plm(log(gsp)~log(pcap)+log(pc)+log(emp)+unemp,data=Produc,
model="random", subset = gsp > 5000)
pdim(z)
#> Unbalanced Panel: n = 48, T = 9-17, N = 808