*! version 2.0 12jul2022

Title

gintreg -- Generalized Interval Regression

Syntax

gintreg
depvar1
depvar2
[indepvars]
[if]
[in]
[, options]

depvar1 and depvar2 should have the following form:

Type of data depvar1 depvar2

point data a = [a,a] a a
interval data [a,b] a b
left-censored data (-inf,b] . b
right-censored data [a,inf) a .

If using grouped data then the form will be similar:

Type of data depvar1 depvar2 frequency

point data a = [a,a] a a n
interval data [a,b] a b n
left-censored data (-inf,b] . b n
right-censored data [a,inf) a . n

Main
distribution(dist_type) Supported distributions come from the Skewed Generalized t and Generlized Beta of the Second Kind families of distributions, namely:

Distribution dist_type

Normal normal
Skewed Normal snormal
Laplace laplace
Skewed Laplace slaplace
Generalized Error ged
Skewed Generalized Error sged
t t
Generalized t gt
Skewed t st
Skewed Generalized t sgt
Lognormal lnormal
Weibull weibull
Gamma gamma
Generalized Gamma ggamma
Burr type 3 br3
Burr type 12 br12
Generalized Beta of the Second Kind gb2

constraints(numlist) specified linear constraints by number to be applied. Can use this option along with distribution to allow for any distribution in the SGT or GB2 family trees.

frequency(varlist) if using group data specify variable that denotes frequency.

Model
sigma(varlist) allows the log of sigma to vary as a linear function of independent variables; can use with any dist_type except gamma.

lambda(varlist) allows lambda to vary as a function of independent variables; can use with dist_type snormal, slaplace, sged, st or sgt.

p(varlist) allows p to vary as a linear function of independent variables; can use with dist_type ged, sged, gt, sgt, gamma, ggamma, br3 or gb2.

q(varlist) allows q to vary as a linear function of independent variables; can use with dist_type t, gt, st, sgt, br12 or gb2.

SE/Robust
vce(vcetype) vcetype may be oim, robust, cluster clustvar, opg, bootstrap or jackknife.

robust use robust standard errors.

cluster(varlist) cluster standard errors with respect to sampling
unit varlist.

Estimation
initial(numlist) initial values for p,q and lambda in that order. if the distribution does not have p, q or lambda, key in initial values for mu and lnsigma in that order.
Because of the construction of gintreg, redundant values are sometimes required, e.g. three values are required for the t distribution (corresponding to p, q, lambda) despite p and lambda being constrained to 2 and 0.

Distribution initial values

Normal none
Skewed Normal 2, lambda
Laplace none
Skewed Laplace 1, lambda
Generalized Error p, 0
Skewed Generalized Error p, lambda
t 2, q, 0
Generalized t p, q, 0
Skewed t 2, q, lambda
Skewed Generalized t p, q, lambda
Lognormal none
Weibull none
Gamma p
Generalized Gamma p
Burr type 3 p, 1
Burr type 12 1, q
Generalized Beta of the Second Kind p, q

maximize_options control the
maximization process

Display
eyx(stat) shows the expected value of depvar conditional on indepvars at indicated level of stat; default is mean.

plot(numlist) plots the probability density function over chosen range.

gini prints the gini coefficient. Only operational with Weibull, Gamma, Burr type 3 and Burr type 12.

aicbic prints AIC and BIC values of the estimated model. Operational with non-grouped data.

Description

gintreg fits a model of depvar on indepvars using maximum likelihood
where the dependent variable can be point data, interval data, right-censored data,
left-censored data or grouped data with different error distributions. This is a generalization of the built in STATA command intreg and will yield identical estimates if the normal distribution option is used. Unlike intreg, gintreg allows the underlying variable of interest to be distributed according to a more general distribution including all distributions in the Skewed Generalized t (SGT) family and Generalized Beta of the Second Kind (GB2) family. gintreg can also be used to fit different distributions to variables of interest. Finally, gintreg allows the distributional parameters in the SGT and GB2 to be functions of designated explanatory variables.

The assumed model for interval regression is y = Xb + u for the SGT family and ln(y) = Xb + u for the GB2 family, where only the thresholds containing the latent variable y are observed, X is a vector of explanatory variables with a corresponding coefficient vector b and the random disturbance u is assumed to be independently and identically distributed according to the selected distribution. The upper and lower thresholds for y can be denoted by U and L respectively.

The conditional probability that y is in the interval (L,U) is: Pr(L <= y <= U)
= F(eps = U - XB: theta) - F(eps: L-XB: theta), where F denotes the cdf of the
random disturbances and theta denotes a vector of distributional parameters.
gintreg uses MLE on the corresponding log-likelihood function to estimate
beta (displayed as mu or delta in the output) and the distributional parameters
theta.

Options

Main

distribution(dist_type) specifies the type of distribution used in the interval regressions.
gintreg will use a log-likelihood function composed of the pdf and cdf of this distribution
(pdf for point data and cdf for intervals and censored observations). dist_type may be normal, snormal,
laplace, slaplace, ged, sged, t, gt, st, sgt, lnormal, weibull, gamma, ggamma, br3, br12, gb2; the default is normal.

constraints(numlist) specified linear constraints by number to be applied. Can use this option along with distribution to allow for any distribution in the SGT or GB2 family trees. Constraints are defined using the constraint command; see [R] constraint. Examples using this option are also provided below.
gintreg natively uses constraints for many distributions; when applying your own, be careful not to define with same number identifier as one already used. The list of constraints are printed right above the output table or are returnable with . constraint list after estimation. Or, simply use an integer >=3 as the identifier, eg . constraint define 3 sigma[_cons]=1.

frequency(varlist) if using grouped data, specify the variable
that denotes the frequency of the observation. Can be in percentage terms or
levels as gintreg will normalize by summing the value of
frequency for all observations. E.g. . gintreg depvar1 depvar2 indepvars, freq(freqvar)

Model

The indepvars specified will allow the location parameter (mu, delta or b) to vary
as a function of the independent variables. The other parameters in the distribution
can also be a function of explanatory variables by using the commands below.

sigma(varlist) allows the log of sigma to be a linear function of varlist and can
model heteroskedasticity.

lambda(varlist) allows lambda to be a nonlinear function of varlist that bounds lambda to be
between -1 and 1 and can model skewness. In order to accomplish this, gintreg first estimates an intermediary "alpha"
as a linear combination of varlist. In instances where lambda(varlist) is not used and only a constant is esitmated, alpha is transformed into lambda, nonlinearly as to be bounded
between -1 and 1, using the following equations:

lambda[_cons] = (exp(alpha[_cons]-1)) / (exp(alpha[_cons]+1))
lambda[_se] = (alpha[_se]*2*exp(alpha[_cons])) / (exp(alpha[_cons]+1)^2)

When lambda(varlist) is used, however, only the intermediary alpha is reported; this is done to avoid imposing a nonlinear functional form that maps the transformation from a vector of alpha's coefficients to lambda's. Therefore, using this option is useful in determining significance of indepvars on skewness, but the coefficients should not be taken literally.

p(varlist) allows p to be a linear function of varlist. A shape parameter
that impacts the tail thickness and peakedness of the distribution.

q(varlist) allows q to be a linear function of varlist. A shape parameter
that impacts the tail thickness and peakedness of the distribution.

Standard Errors

vce(vcetype) specifies the type of standard error reported, which includes
types that are robust to some kinds of misspecification (robust), that
allow for intragroup correlation (cluster clustvar), and that are
derived from asymptotic theory (oim, opg); see [R] vce_option.

robust use robust standard errors.

cluster(varlist) cluster standard errors with respect to sampling
unit varlist.

Estimation

initial(numlist)
list of numbers that specifies the initial values of the parameters in the constant
only model. This must be equal to the number of distributional parameters, which are presented in initial under Syntax.

maximize_options:
difficult,
technique(algorithm_spec),
iterate(#),
[no]log,
trace,
gradient,
showstep,
hessian,
showtolerance,
tolerance(#),
ltolerance(#),
nrtolerance(#); see [R] maximize. Allowed techniques include Newton-Raphson (nr), Berndt-Hall-Hausman (bhhh), Davidon
-Fletcher-Powell (dfp), and Broyden-Fletcher-Goldfarb-Shanno (bfgs). The default
algorithm is Newton-Raphson.

Display

eyx(stat) This option helps with inference in models with a positive distribution
(gb2, gg, lnormal). At the end of the STATA printout, it displays the estimated conditional value of the dependent variable
with respect to the independent variables being at the level of stat. This result is returned and is accessible after estimation
by e(eyx).

If stat is not specified then the independent variables will be taken at their mean levels:

stat

mean mean values of independent variables

min minimum values of independent variables

max maximum values of independent variables

p1 1st percentile of independent variables

p5 5th percentile of independent variables

p10 10th percentile of independent variables

p25 25th percentile of independent variables

p50 50th percentile of independent variables

p75 75th percentile of independent variables

p90 90th percentile of independent variables

p95 95th percentile of independent variables

p99 99th percentile of independent variables

plot(numlist) Uses the estimated constants only and twoway_function to plot the selected distribution with the estimated parameters over a range of the
user's choice. numlist takes a lower and upper bound in the same way range(numlist) does in twoway_function, ie plot(0 1).
To flexibly plot PDFs, see gintreg's companion program, pdfplot.

gini Calculates and displays the gini coefficient if the selected distribution is Weibull, Gamma, Burr type 3 or Burr type 12. To find the gini of a Generalized Beta of the Second Kind distribution, see gb2dist.

To install gb2dist:

. net from "http://coin.wne.uw.edu.pl/mbrzezinski/software"

. net describe gb2dist

aicbic Calculates and displays the Akaike Information Criterion and Bayesian Information Criterion.
These are returnable values with "e(aic)" and "e(bic)".
The equations are given, where k denotes the number of estimated parameters in the model,
lnL is the maximized log-likelihood value for the model, and N denotes the sample size:

AIC = 2*k-2*lnL
BIC = k*ln(N)-2*lnL

Remarks

If the optimization is not working, try using the difficult option. You can also use the option technique(bfgs), or the other two technique options,
which are often more robust than the default technique(nr).

Several parameterizations for the GB2 are found in the literature. One of the most common involves the parameters a,b,p,q. gintreg uses a different parameterization with sigma,delta,p,q where the two parameterizations are related as follows: b=exp(delta) and a=1/exp(sigma). This version of gintreg reports both sets of estimates. See Wikipedia for additional details about the definitions and interrelationships for the Generalized Beta Distribution and for the Skewed Generalized t Distribution.

Examples

Load the example dataset

. webuse intregxmpl

This file has data on wages reported in intervals (wage1, wage2) as well as point data measured in $1,000's (wage), age in current year (age), if never married (nev_mar), rural status ie 1 if not SMSA (rural), lastest grade completed (school) and job tenure in years (tenure).

wage1 wage2

20 25 meaning 20000 <= wage <= 25000

50 . meaning 50000 <= wage

Fitting Normal pdf using interval data

. gintreg wage1 wage2

Interval regression with a normal distribution

. gintreg wage1 wage2 age nev_mar rural school tenure

Regular regression with a normal distribution

. gintreg wage wage age nev_mar rural school tenure

Interval regression with a gb2 distribution using difficult option

. gintreg wage1 wage2 age nev_mar rural school, distribution(gb2) diff

Interval regression with a gb2 distribution with the expected value of the
dependent variable evaluated when the independent variables are at the 25 percentile (E[Y|X] appears
at the end of the printout

. gintreg wage1 wage2 age, distribution(gb2) eyx(p25)

The following two regressions both fit a Burr type 3

. gintreg wage1 wage2 age nev_mar rural school tenure, dist(br3)

. constraint define 1 [q]_cons=1

. gintreg wage1 wage2 age nev_mar rural school tenure, dist(gb2) constr(1)

Fitting a Burr type 3 to interval data for wages, plotting the fitted pdf and printing the Gini coefficient

. gintreg wage1 wage2, dist(br3) plot(0 150) gini

Interval regression with a sgt distribution allowing log(sigma) to vary as a function of independent variables [heteroskedasticity]

. gintreg wage1 wage2 age nev_mar rural school tenure, distribution(sgt) sigma(age nev_mar rural school tenure)

FItting a Generalized Beta of the Second Kind from an estimated Burr type 3

. gintreg wage1 wage2, dist(gb2) init(.965 1)

Author

Originally authored in 2016 by James McDonald and Jacob Orchard at Brigham Young University.
Will Cockriel, Bryan Chia, Jonny Jensen and Jacob Triplett have joined James McDonald as additional collaborators over the years.
The program reached version 2.0 in 2022. Jacob Triplett can be contacted for support at "jacobwtriplett@icloud.com".

References

James B. McDonald, Olga Stoddard, and Daniel Walton. 2018.
On using interval response data in experimental economics,
Behavioral and Experimental Economics, 72:9-16.

James B. McDonald, Daniel Walton and Bryan Chia. 2020.
Distributional Assumptions and the Estimation of Contingent Valuation Models,
Computational Economics, 52:431-460.

Michal Brzezinki. 2012. gb2dist Stata command. "http://coin.wne.uw.edu.pl/mbrzezinski/software".

Skewed Generalized t Distribution, Wikipedia, "https://en.wikipedia.org/wiki/Skewed_generalized_t_distribution".

Generalized Beta of the Second Kind Distribution, Wikipedia, "https://en.wikipedia.org/wiki/Generalized_beta_distribution#Generalized_beta_of_the_second_kind_(GB2)".