xtset: prepares a panel dataset for lag operations

Description Usage Arguments Value Examples

Description

prepares a panel dataset for lag operations. The lag function in R is simply "lag(var,numlags)". After calling xtset, this lag function will work on the panel in the way you would expect.

Usage

1
xtset(timevar, obsvar)

Arguments

timevar

the name of the variable to for the time dimension

obsvar

the name of the variable to use for the observation dimension

Value

returns NULL, invisibly

Examples

1
2
3
4
5
6
7
8
9
library(plm)
data(Produc)
use(Produc, clear=TRUE)
xtset(year, state)
gen(Lemp, L(emp))
listif(vars="emp Lemp")
reg(emp, unemp, effect="twoway")
reg(emp, unemp, effect="individual")
reg(emp, unemp, effect="time")

genvar documentation built on Jan. 21, 2020, 9:07 a.m.