Learn R Programming

BMisc (version 1.4.8)

block_boot_sample: Block Bootstrap

Description

make draws of all observations with the same id in a panel data context. This is useful for bootstrapping with panel data.

Usage

block_boot_sample(data, idname)

Value

data.frame bootstrapped from the original dataset; this data.frame will contain new ids

Arguments

data

data.frame from which you want to bootstrap

idname

column in data which contains an individual identifier

Examples

Run this code
# \dontshow{
if (!requireNamespace("plm")) {
  if (interactive() || is.na(Sys.getenv("_R_CHECK_PACKAGE_NAME_", NA))) {
    stop("package 'plm' is required for this example")
  } else {
    q()
  }
}
# }
data("LaborSupply", package = "plm")
bbs <- block_boot_sample(LaborSupply, "id")
nrow(bbs)
head(bbs$id)

Run the code above in your browser using DataLab