subpop {SortedEffects} | R Documentation |
Inference on Most and Least Affected Groups
Description
subpop
conducts set inference on the groups of most and least
affected. When subgroup = NULL
, output is for whole sample. Otherwise
the results are subgroup. The output of subpop
is a list
containing six components: cs_most
, cs_least
, u
,
subgroup
, most
and least
. As the names
indicate, cs_most
and cs_least
denote the confidence sets for
the most and least affected units. u
stores the u-th most and least
affected index. subgroup
stores the indicators for subpopulations.
most
and least
store the data of the most and
least affected groups. The confidence sets can be visualized using the
plot.subpop
command while the two groups can be tabulated via
the summary.subpop
command.
Usage
subpop(
fm,
data,
method = c("ols", "logit", "probit", "QR"),
var_type = c("binary", "continuous", "categorical"),
var,
compare,
subgroup = NULL,
samp_weight = NULL,
taus = c(5:95)/100,
u = 0.1,
alpha = 0.1,
b = 500,
seed = 1,
parallel = FALSE,
ncores = detectCores(),
boot_type = c("nonpar", "weighted")
)
Arguments
fm |
Regression formula |
data |
The data in use |
method |
Models to be used for estimating partial effects. Four
options: |
var_type |
The type of parameter in interest. Three options:
|
var |
Variable T in interset. Should be a character. |
compare |
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 |
subgroup |
Subgroup in interest. Default is |
samp_weight |
Sampling weight of data. Input should be a n by 1 vector,
where n denotes sample size. Default is |
taus |
Indexes for quantile regression.
Default is |
u |
Percentile of most and least affected. Default is set to be 0.1. |
alpha |
Size for confidence interval. Shoule be between 0 and 1. Default is 0.1 |
b |
Number of bootstrap draws. Default is set to be 500. |
seed |
Pseudo-number generation for reproduction. Default is 1. |
parallel |
Whether the user wants to use parallel computation.
The default is |
ncores |
Number of cores for computation. Default is set to be
|
boot_type |
Type of bootstrap. Default is |
Examples
data("mortgage")
### Regression Specification
fm <- deny ~ black + p_irat + hse_inc + ccred + mcred + pubrec +
ltv_med + ltv_high + denpmi + selfemp + single + hischl
### Issue the subpop command
set_b <- subpop(fm, data = mortgage, method = "logit", var = "black",
u = 0.1, alpha = 0.1, b = 50)