fsst: Conducts inference using the FSST procedure

View source: R/fsst.R

fsstR Documentation

Conducts inference using the FSST procedure

Description

This module conducts inference in linear programs using the procedure by Fang, Santos, Shaikh and Torgovitsky (2020).

Usage

fsst(
  data = NULL,
  lpmodel,
  beta.tgt,
  R = 100,
  Rmulti = 1.25,
  lambda = NA,
  rho = 1e-04,
  n = NULL,
  weight.matrix = "diag",
  solver = NULL,
  progress = TRUE,
  sqrtm.method = function(m) pracma::sqrtm(m)$B,
  sqrtm.tol = .Machine$double.eps^(1/2),
  previous.output = NA
)

Arguments

data

An data frame or a matrix.

lpmodel

The lpmodel object.

beta.tgt

The value to be tested.

R

The number of bootstrap replications.

Rmulti

The multiplier for the number of bootstrap replications. The product of Rmulti and R refers to the maximum number of bootstrap replications to be conducted if there are errors.

lambda

Parameter used to obtain the restricted estimator \widehat{\bm{β}}^r_n. A data-driven parameter lambda can be included if NA is included as part of the vector for lambda. For instance, if lambda is set as c(0.1, NA), then both 0.1 and the data-driven lambda will be applied in the fsst test. The default is to use the data-driven lambda.

rho

Parameter used in the studentization of matrices.

n

The sample size. This is only required if data is omitted in the input.

weight.matrix

The option used in the weighting matrix. There are three options available:

  • identity — identity matrix

  • diag — the diagonal matrix that takes the diagonal elements of the inverse of the variance matrix

  • avar — inverse of the variance matrix

solver

The name of the linear and quadratic programming solver that is used to obtain the solution to linear and quadratic programs. The solvers supported by this package are cplexAPI, gurobi, limSolve and Rcplex.

progress

The boolean variable for whether the progress bars should be displayed. If it is set as TRUE, the progress bars will be displayed while the code is running.

sqrtm.method

The method used to obtain the matrix square root in the fsst procedure. This has to be a function that takes one argument that accepts a square matrix of size k x k and returns a square matrix of size k x k, where k can be the length of the β(P) vector, or the beta.obs component of the lpinfer object.

sqrtm.tol

The absolute tolerance used to check whether the matrix square root is correct. This is done by checking whether the Frobenius norm is smaller than the tolerance level, i.e., when A is the give matrix, B is the matrix square root obtained from the given sqrtm.method function, and ε is the tolerance level, the FSST test checks whether ||A - BB||_F < ε. If this does not hold, the FSST test will use the sqrtm function from the expm package to obtain the matrix square root.

previous.output

The list of outputs obtained from the previous evaluation of the procedure. This is only used in the fsst test and when previous.out contains the studentized matrix omega.i. The rest of the arguments are ignored.

Details

The following components are required in the lpmodel for the fsst procedure:

  • A.tgt

  • A.obs

  • A.shp

  • beta.obs

  • beta.shp

Value

Returns the following information:

pval

A table of p-values.

cv.table

A table of sample and bootstrap Cone and Range test statistics.

call

The matched call.

range

The sample range test statistic.

cone

The sample cone test statistic.

test

The sample test statistic.

cone.n.list

The list of bootstrap cone test statistics.

range.n.list

The list of bootstrap range test statistics.

solver.name

Name of the solver used.

rho

The value of rho provided by the user.

rhobar.i

The regularization parameter used for the Cone studentization matrix.

lambda.data

The value of the data-driven lambda (if applicable).

var.method

The method used in obtaining the asymptotic variance of beta.obs.

test.logical

An indicator variable for whether the computation has been conducted. If test.logical is 1, it refers to the case where beta.tgt is inside the logical bound. If test.logical is 0, it refers to the case where beta.tgt is outside the logical bound.

logical.lb

Logical lower bound.

logical.ub

Logical upper bound.

df.error

A table showing the id of the bootstrap replication(s) with error(s) and the corresponding error message(s).

R.succ

The number of successful bootstrap replications.

Example

  source("./example/dgp_missingdata.R") # Change directory if necessary
  J <- 5
  N <- 1000
  data <- missingdata_draw(J = J, n = N, seed = 1, prob.obs = .5)
  lpm <- missingdata_lpm(J = J, info = "full", data = data)
  fsst(data = data,
       lpmodel = lpm,
       beta.tgt = .2,
       R = 100,
       lambda = .2,
       rho = 1e-4,
       weight.matrix = "identity",
       solver = "gurobi")

More examples

More examples can be found in the fsst_example.R file under the example subdirectory of the installation directory for the lpinfer package.


conroylau/lpinfer documentation built on Oct. 23, 2022, 9:21 a.m.