Learn R Programming

plm (version 1.2-0)

pdim: Check for the Dimensions of the Panel

Description

This function checks the number of individuals and time observations in the panel and whether it is balanced or not.

Usage

pdim(x,...)
## S3 method for class 'data.frame':
pdim(x, index = NULL, ...)
## S3 method for class 'panelmodel':
pdim(x, ...)
## S3 method for class 'pdata.frame':
pdim(x, ...)

Arguments

x
a data.frame, a pdata.frame or a panelmodel object,
index
see pdata.frame,
...
further arguments.

Value

  • an object of class pdim containing the following elements :
  • nTa list containing n, the number of individuals, T, the number of time observations, N the total number of observations,
  • TinTa list containing two vectors : Ti gives the number of observations for each individuals and nt gives the number of individuals observed for each period,
  • balanceda logical value : TRUE for a balanced panel, FALSE for an unbalanced panel,
  • panel.namesa list of character vectors : id.names contains the names of each individual and time.names contains the names of each period.

Details

pdim is called by the estimation functions.

See Also

pdata.frame

Examples

Run this code
#There are 595 individuals

data("Wages", package="plm")
pdim(Wages, 595)

# Gasoline contains two variables which are individual and time indexes
# and are the first two variables
data("Gasoline", package="plm")
pdim(Gasoline)

# Hedonic is an unbalanced panel, townid is the individual index
data("Hedonic", package="plm")
pdim(Hedonic, "townid")

# 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)

Run the code above in your browser using DataLab