Learn R Programming

csranks (version 1.0.1)

cstaubest: Projection confidence sets for the tau-best

Description

Find a set of populations, which belong to tau-best populations according to some feature with given confidence.

Usage

cstaubest(
  x,
  Sigma,
  tau = 2,
  coverage = 0.95,
  stepdown = TRUE,
  R = 1000,
  na.rm = FALSE,
  seed = NA
)

cstauworst( x, Sigma, tau = 2, coverage = 0.95, stepdown = TRUE, R = 1000, na.rm = FALSE, seed = NA )

Value

logical vector indicating which of the elements of x are in the confidence set for the tau-best.

Arguments

x

vector of estimates.

Sigma

covariance matrix of x. Note, that it must be covariance matrix of feature means, not features themselves.

tau

the confidence set contains indicators for the elements in x whose rank is less than or equal to tau.

coverage

nominal coverage of the confidence set. Default is 0.95.

stepdown

logical; if TRUE (default), stepwise procedure is used, otherwise single step procedure is used. See Details section for more.

R

number of bootstrap replications. Default is 1000.

na.rm

logical; if TRUE, then NA's are removed from x and Sigma (if any).

seed

seed for bootstrap random variable draws. If set to NA (default), then seed is not set.

Functions

  • cstauworst(): Projection confidence sets for the tau-worst

    Similar method, but for populations, which are tau-worst. Equivalent to calling cstaubest with -x.

Details

The confidence set contains indicators for the elements in x whose rank is less than or equal to tau with probability approximately equal to the coverage indicated in coverage. Parametric bootstrap based on the multivariate normal distribution.

If na.rm=TRUE and NAs are present, then results are returned for tau-best (worst) populations among those without NA values, i.e. after NA removal.

References

Mogstad, Romano, Shaikh, and Wilhelm (2023), "Inference for Ranks with Applications to Mobility across Neighborhoods and Academic Achievements across Countries", forthcoming at Review of Economic Studies

pdf link tools:::Rd_expr_doi("10.1093/restud/rdad006")

Examples

Run this code
# Setup example data
n <- 10
x <- seq(1, 3, length = n)
Sigma <- matrix(0.001, nrow = n, ncol = n)
diag(Sigma) <- 0.04

# Run csranks to get confidence sets for top 3 populations
cstaubest(x, Sigma, tau = 3)
cstauworst(x, Sigma, tau = 3)

# If you assume that the feature measurements are independent, 
# (or just have access to variances / standard errors)
# then pass a diagonal covariance matrix.
Sigma <- diag(rep(0.04, 10))
cstaubest(x, Sigma, tau = 3)
cstauworst(x, Sigma, tau = 3)

Run the code above in your browser using DataLab