subsample | R Documentation |
This function conducts inference and returns the
p
-value using the subsampling procedure.
subsample(
data = NULL,
lpmodel,
beta.tgt,
R = 100,
Rmulti = 1.25,
norm = 2,
phi = 2/3,
n = NULL,
replace = FALSE,
solver = NULL,
progress = TRUE,
previous.output = NA
)
data |
An |
lpmodel |
The |
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 |
norm |
The norm used in the optimization problem. It can be either a
1-norm or a 2-norm. See the details section of
|
phi |
The tuning parameter for the subsampling test. The size of each
subsample is |
n |
The sample size. This is only required if |
replace |
A boolean variable to indicate whether the function samples the data with or without replacement. |
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 |
progress |
The boolean variable for whether the progress bars should
be displayed. If it is set as |
previous.output |
The list of outputs obtained from the previous
evaluation of the procedure. This is only used in the
|
There are three possible combinations for the parameters
phi
and replace
:
If replace
is set as FALSE
, it refers to the
subsampling procedure. In this case, phi
has to be inside the
interval (0, 1)
.
If replace
is set as TRUE
and phi
is set as 1,
then it refers to the bootstrap procedure.
If replace
is set as TRUE
and phi
is inside the
interval (0, 1)
, then it refers to the m
out of n
bootstrap procedure, where m
is the size of the subsample and
n
is the total number of observations.
The following components are required in the lpmodel
for the
subsampling procedure:
A.tgt
A.obs
A.shp
beta.obs
beta.shp
Returns a list of output calculated from the function:
pval |
The |
T.n |
The test statistic |
T.bs |
The list of bootstrap estimates of the test statistics from the subsampling procedure. |
solver |
The solver used. |
cv.table |
A table of critical values. |
call |
The matched call. |
phi |
The |
norm |
The norm used. |
subsample.size |
The size of subsample |
test.logical |
An indicator variable for whether the computation has
been conducted. If |
logical.lb |
The logical lower bound. |
logical.ub |
The 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. |
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) subsample(data = data, lpmodel = lpm, beta.tgt = .2, R = 100, phi = 2/3, solver = "gurobi")
More examples can be found in the subsample_example.R
file
under the example
subdirectory of the installation directory for
the lpinfer
package.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.