Learn R Programming

genvar (version 0.0.2.0)

xtset: prepares a panel dataset for lag operations

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

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

Run this code
# NOT RUN {
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")
# }

Run the code above in your browser using DataLab