SPE
conducts SPE estimation and inference at user-specifed quantile index. The bootstrap procedures
follows algorithm 2.1 as in Chernozhukov, Fernandez-Val and Luo (2018). All estimates are bias-corrected
and all confidence bands are monotonized. For graphical results, please use SPEplot
.
SPE(fm, data, method = "ols", var.type = "binary", var.T, compare,
subgroup = NULL, samp_weight = NULL, us = c(1:9)/10, alpha = 0.1,
taus = c(1:9)/10, B = 10, ncores = 1, seed = 1, bc = TRUE,
boot.type = "nonpar")
Regression formula.
Data in use.
Models to be used for estimating partial effects. Four options: "logit"
(binary response),
"probit"
(binary response), "ols"
(interactive linear with additive errors), "QR"
(linear model
with non-additive errors). Default is "ols"
.
The type of parameter in interest. Three options: "binary"
, "categorical"
, "continuous"
. Default
is "binary"
.
Variable T in interset. Should be a character type.
If parameter in interest is categorical, then user needs to specify which two category to
compare with. Should be a 1 by 2 character vector. For example, if the two levels to compare
with is 1 and 3, then c=("1", "3")
, which will calculate partial effect from 1 to 3. To use
this option, users first need to specify var.T as a factor variable.
Subgroup in interest. Default is NULL
. Specifcation should be a logical variable. For example, suppose data contains
indicator variable for women (female if 1, male if 0). If users are interested in women SPE, then users
should specify subgroup = data[, "female"] == 1
.
Sampling weight of data. If null then function implements empirical bootstrap.
If data specifies sampling weight, the function implements weighted bootstrap. Input
should be a n by 1 vector, where n denotes sample size. Default is NULL
.
Percentile of interest for SPE. Should be a vector of values between 0 and 1. Default
is c(1:9)/10
.
Size for confidence interval. Shoule be between 0 and 1. Default is 0.1
Indexes for quantile regression. Default is c(1:9)/10
.
Number of bootstrap draws. Default is set to be 10. For more accurate results, we recommend 500.
Number of cores for computation. Default is set to be 1. For large dataset, parallel computing is highly recommended since bootstrap is time-consuming.
Pseudo-number generation for reproduction. Default is 1.
Whether want the estimate to be bias-corrected. Default is TRUE
. If FALSE
uncorrected
estimate and corresponding confidence bands will be reported.
Type of bootstrap. Default is boot.type = "nonpar"
, and the package implements nonparametric
bootstrap. An alternative is boot.type = "weighted"
, and the package implements weighted
bootstrap.
The output is a list with 4 components: (1) spe
stores spe estimates and confidence bounds;
(2) ape
stores ape estimates and confidence bounds; (3) us
stores percentile index as in
SPE
command; (4) alpha
stores significance level as in SPE
command.
# NOT RUN {
data("mortgage")
fm <- deny ~ black + p_irat + hse_inc + ccred + mcred + pubrec + ltv_med +
ltv_high + denpmi + selfemp + single + hischl
test <- SPE(fm = fm, data = mortgage, var.T = "black", method = "logit",
us = c(1:9)/10)
# }
Run the code above in your browser using DataLab