pvar

0th

Percentile

Check for Cross-Sectional and Time Variation

This function checks for each variable of a panel if it varies cross-sectionally and over time.

Keywords
attribute
Usage
pvar(x, ...)

# S3 method for matrix pvar(x, index = NULL, ...)

# S3 method for data.frame pvar(x, index = NULL, ...)

# S3 method for pdata.frame pvar(x, ...)

# S3 method for pseries pvar(x, ...)

# S3 method for pvar print(x, ...)

Arguments
x

a (p)data.frame or a matrix,

further arguments.

index

see pdata.frame(),

Details

For (p)data.frame and matrix interface: All-NA columns are removed prior to calculation of variation due to coercing to pdata.frame first.

Value

An object of class pvar containing the following elements:

id.variation

a logical vector with TRUE values if the variable has individual variation, FALSE if not,

time.variation

a logical vector with TRUE values if the variable has time variation, FALSE if not,

id.variation_anyNA

a logical vector with TRUE values if the variable has at least one individual-time combination with all NA values in the individual dimension for at least one time period, FALSE if not,

time.variation_anyNA

a logical vector with TRUE values if the variable has at least one individual-time combination with all NA values in the time dimension for at least one individual, FALSE if not.

Note

pvar can be time consuming for ``big'' panels.

See Also

pdim() to check the dimensions of a 'pdata.frame' (and other objects),

Aliases
  • pvar
  • pvar.matrix
  • pvar.data.frame
  • pvar.pdata.frame
  • pvar.pseries
  • print.pvar
Examples
# NOT RUN {

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

# Hedonic is an unbalanced panel, townid is the individual index;
# the drop.index argument is passed to pdata.frame
data("Hedonic", package = "plm")
pvar(Hedonic, "townid", drop.index = TRUE)

# same using pdata.frame
Hed <- pdata.frame(Hedonic, "townid", drop.index = TRUE)
pvar(Hed)

# Gasoline with pvar's matrix interface
Gasoline_mat <- as.matrix(Gasoline)
pvar(Gasoline_mat)
pvar(Gasoline_mat, index=c("country", "year"))

# }
Documentation reproduced from package plm, version 2.2-5, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.