Subpop: Inference on Most and Least Affected Groups

Description Usage Arguments Examples

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 results can be visualized using the Subpopplot command. The output of Subpop is a list containing four components: most, least, u and sub. As the names indicate, most and least denote the confidence sets for the most and least affected units. u stores the u-th most and least affected index and sub stores the indicators for subpopulations.

Usage

1
2
3
4
Subpop(fm, data, method = "ols", var.type = "binary", var.T, compare,
  subgroup = NULL, samp_weight = NULL, taus = c(1:9)/10, u = 0.1,
  alpha = 0.1, B = 10, ncores = 1, seed = 1,
  boot.type = "nonpar")

Arguments

fm

Regression formula

data

The data in use

method

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".

var.type

The type of parameter in interest. Three options: "binary", "categorical", "continuous". Default is "binary".

var.T

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 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

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.

samp_weight

Sampling weight of data. If null then function implements empirical bootstrap. If data specifies sampling weight, put that in and the function implements weighted (i.i.d exponential weights) bootstrap.

taus

Indexes for quantile regression. Default is c(1:9)/10.

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 10. For more accurate results, we recommend 500.

ncores

Number of cores for computation. Default is set to be 1. For large dataset, parallel computing is highly recommended since bootstrap is time-consuming.

seed

Pseudo-number generation for reproduction. Default is 1.

boot.type

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.

Examples

1
2
3
data("mortgage")
fm <- deny ~ black + p_irat + hse_inc
result <- Subpop(fm = fm, data = mortgage, var.T = "black", method = "logit")

yuqimemeda/SortedEffects documentation built on May 23, 2019, 9:51 a.m.