powered by
returns a subsample of a panel data set; in particular drops all observations that are not in keepids. If it is not set, randomly keeps nkeep observations.
keepids
nkeep
subsample(dta, idname, tname, keepids = NULL, nkeep = NULL)
a data.frame which is a balanced panel
the name of the id variable
the name of the time variable
which ids to keep
how many ids to keep (only used if keepids is not set); the default is the number of unique ids
a data.frame that contains a subsample of dta
dta
# NOT RUN { data(LaborSupply, package="plm") nrow(LaborSupply) unique(LaborSupply$year) ss <- subsample(LaborSupply, "id", "year", nkeep=100) nrow(ss) # }
Run the code above in your browser using DataLab