*! version 14.2 06nov2022
help divratio

Title

divratio -- Computes shares and diversions using a semiparametric logit model that assumes homogemous preferences
for groups of observably similar observations. Based on Raval, Rosenbaum, and Tenn (2017). Often referred to as the "bin method."

Syntax

divratio
a_side b_side loc_id firm_id geo prod

,
[options]

Main
groups(varlist) patient characteristic variables to define groups.

wtp calculate willingness-to-pay in addition to diversion ratios.

ungrouped(string) instructions on what to do with observations that cannot be grouped.

weight(varlist) a weight for each observation in the data.

allow_within allows hospital-to-hospital diversions within the same owner.

replacement groups variables based on resampling with replacement.

geo_ref(string) specify the service area reference firm.

prod_ref(string) specify the products of reference firm.

svc_pct(integer) specify service area percentage.

outside_cutoff(real) specify share percentage to be considered in choice set.

min_group_size(integer) minimum number of observations per group.

topcode(real) percentage to ensure probabilities are less than one for WTP calculations.

inter_input(string) inputs saved group probabilities from previous runs of the program.

Results
save_inter(string) save intermediate files; specify filepath.

output(string) save results; specify filepath.

disp_str(integer) characters to display for strings in results.

Description

divratio computes diversions using a model that groups
observably similar observations, and assumes that within each group or bin, the
idiosyncratic error of each observation's preferences are iid Extreme Value. As
a result, the share of location choices takes on a logit form and diversions
within each bin can be computed analytically.

The inputs are as follows: a_side is an indicator variable that equals 1
for observations that chose the A-side, b_side is an indicator variable
that equals 1 for observations that chose the B-side, loc_id is a categorical
variable that represents store locations, firm_id is a categorical variable
that represents the firm that owns the store locations, geo is a categorical
variable that represents geographic regions (e.g. zip codes), and prod is
a categorical variable that represents products offered by the firm.

This function will automatically compute diversion for the svc_pct%
service area based on geo for products the A-side and B-side both sell based
on prod. The grouping variables are specified using groups(varlist).

Options

Main

groups(varlist) specifies patient characteristic variables used to create the
groups. If omitted, share-based diversions will be calculated.

wtp is a flag such that when used, WTP analysis is calculated in addition to diversions. If omitted,
only diversion ratios will be calculated.

ungrouped(string) specifies what the program should do with ungrouped observations using the "groups"
variables. The input can either be "keep", in which a degenerate variable "all" will be created and
used as the first group, or "drop", in which the ungrouped observations will be dropped. If unspecified,
the ungrouped observations will be dropped.

weight(varlist) specifies variable used to weight each observation. For example,
if an observation in the data represents customer counts, then the count variable
should be use here. If omitted, will assume each observation represents an individual.

allow_within is a flag such that when used, diversions are computed including
other hospitals that are owned by the system as specified by owner_id. If omitted,
the model will not allow for customers to divert to hospitals owned by the same system.

replacement is a flag such that when used, group probabilities will be calculated by
resampling the entire dataset for all customers that satisfy each grouping level. If omitted,
group probabilities will be calculated only using customers that were not previously used
to calculate group probabilities at a higher grouping level.

geo_ref(string) specifies the reference hospitals in which to compute geographic
service areas. Can either be the A-side, B-side, combined, or union. Set equal to "a-side" for the A-side,
"b-side" for the B-side, "combined" for the combined service area, or "union" for the union of the
two service areas. If ommitted, will use the union of the two service areas.

prod_ref(string) specifies the reference hospitals in which to consider relevant
products. Can either be the A-side, B-side, overlapping, or union. Set equal to "a-side" for
the A-side, "b-side" for the B-side, "union" for all, or "overlap" for the overlapping.
If ommitted, will calculate for overlapping products.

svc_pct(integer) specifies the what percent service area should be used. If
omitted, the analysis will use the 75% service area.

min_group_size(integer) specifies the minimum number of observations within a
group. This is the "tuning parameter" in Raval, et. al. If omitted, the minimum number
of observations per group will be set to 20.

outside_cutoff(real) specifies what share percentage to use to consider which firm
locations are considered as in the choice set. If omitted, a 0.005% cutoff will
be used.

inter_input(string) inputs the choice probabilities file from previous runs of the
program to save time. If used save_inter in previous run, then input file will be
given by "Results - Choice Probabilities.dta".

Results

save_inter(string) is used to save the intermediate files that are created
in the analysis in the specified file location string. This includes files
that specify overlapping products, the service areas, the samples used to conduct
analysis, etc. If omitted, no files will be saved.

output(string) is used to save the final results to a file specified in
string. If both save_inter and output are both omitted, no
files will be saved. If only output is omitted, the results will save to
the the filepath specified in save_inter.

disp_str(integer) specifies the nubmer of characters for string variables
to be displayed in the output results. If omitted, the results will display 30
characters.

Example

For hospital mergers, an example may be:

divratio a_side b_side hospital current_system pat_zip drg, groups(pat_county pat_zip mdc drg age female) svc_pct(90)

This command will compute diversions for each hospital in hospital within the
90% combined service area for the A-side and B-side based on patient zip codes. This will also focus on DRGs
in which the parties overlap. In addition, it will estimate the diversions from
the A-side hospital to each hospital in hospital and from
the B-side hospital to each hospital in hospital using the semiparametric model
that groups over pat_county, pat_zip, mdc, drg, age, and female.

Additional Notes

If you do not want to limit over geographic regions or products, set geo or
prod equal to a degenerate variable, e.g. a vector of all ones. If you do
not want to limit service areas, set the option svc_pct equal to 100.

References

Raval, Devesh, Ted Rosenbaum and Steve Tenn. "Semiparametric Discrete Choice Model: An Application to Hospital Mergers." Economic Inquiry, 2017, 55(4), 1919-1944.

Raval, Devesh, Ted Rosenbaum and Nathan Wilson. "Using Disaster Induced Closures to Evaluate Discrete Choice Models of Hospital Demand." RAND Journal of Economics, 2022, 53(3), 561-589.

Contact Information

Author: Christopher V. Lau

Email: chris.vlau@gmail.com