Function DiSSMod
fits sample selection models for discrete random
variables, by suitably extending the formulation of the classical
Heckman model to the case of a discrete response, but retaining the
original conceptual framework. Maximum likelihood estimates are obtained
by Newton-Raphson iteration combined with use of profile likelihood.
DiSSMod(response, selection, data, resp.dist, select.dist, alpha,
trunc.num, standard = FALSE, verbose = 1, eps = 1e-07,
itmax = 1000)
a formula for the response equation.
a formula for the selection equation.
a data frame and data has to be included with the form of data.frame
.
a character for the distribution choice of the response variable,
"bernoulli"
for Bernoulli distribution, "poisson"
for Poisson distribution,
and "negbinomial"
for Negative binomial distribution. Also, the character strings
can be abbreviated and can be upper or lower case as preferred.
a character for the distribution choice of the selection variable,
"gumbel"
for Gumbel distribution, "normal"
for Normal distribution,
and "logistic"
for Logistic distribution. Also, the character strings
can be abbreviated and can be upper or lower case as preferred.
a vector of \(alpha\) values on which the profile log-likelihood function is evaluated;
if the argument is missing, a set of values in the interval (-10, 10)
is used for the initial search,
followed by a second search on a revised interval which depends on the outcome from the first search.
an integer numeric constant used as the truncation point of an infine summation of probabilities
involved when resp.dist
equals "Poisson"
or "NegBinomial"
;
if the argument is missing, a default choice is made, as described in the ‘Details’ section. Notice: this
default choice of trunc.num
may be subject to revision in some future version of the package,
and the argument trunc.num
itselt may possibly be replaced by some other ingredient.
a logical value for the standardizing explanatory variables, if TRUE
two types of values
(standardized and not) will be returned.
an integer value for the level of printed details (values: 0|1|2); the default value is 1 which stands for shortly printed details. If the value is 2, more details are viewed such as values of the log likelihood functions and iteration numbers. If the value is 0, there is no printed detail.
a numeric value for the estimating parameters, which is needed for the step of the optimization.
If the sum of absolute differences between present step estimated parameters and former step
estimated parameters is smaller than eps
, we assume that estimated parameters are
optimized.
an integer stands for maximum number for the iteration of optimizing the parameters.
DiSSMod
returns an object of class "DiSSMod"
,
which is a list containing following components:
a matched call.
a logical value, stands for standardization or not.
a vector containing the differences between log likelihoods and maximized log likelihood.
a maximized log likelihood value.
a maximized likelihood estimator of alpha.
a vector containing grids of the alpha
a vector containing proper alpha, which does not have
NA
value for corresponding log likelihood.
a number of NA
values of log likelihoods.
a number of selected response variables.
a number of all response variables.
estimated values for the response model.
estimated standard errors for the response model.
estimated values for the selection model.
estimated standard errors for the selection model.
Function DiSSMod
fits sample selection models for discrete random variables,
by suitably extending the formulation of the classical Heckman model to the case of a discrete response,
but retaining the original conceptual framework.
This logic involves the following key ingredients: (1) a linear model indicating which explanatory variables
influence the response variable; (2) a linear model indicating which (possibly different) explanatory variables,
besides the response variable itself, influence a `selection variable', which is intrinsically continuous but
we only observe a dichotomous outcome from it, of type Yes-No, which selects which are the observed response cases;
(3) distributional assumptions on the response and the selection variable.
The data fitting method is maximum likelihood estimation (MLE), which operates in two steps: (i) for each given value of parameter \(alpha\) which regulates the level of selection, MLE is performed for all the remaining parameters, using a Newton-Raphson iteration; (ii) a scan of the \(alpha\) axis builds the profile log-likelihood function and its maximum point represents the overall MLE.
A detailed account of the underlying theory and the operational methodology is provided by Azzalini et al. (2019).
The specification of the two linear models regulating the response variable and
the selection mechanism, as indicated in the ‘Background’ section,
is accomplished by two arguments of formula
type,
denoted response
and selection
, respectively.
Each formula
is specified with the same syntax of similar arguments in
standard functions such as lm
and glm
, with the restriction that
the intercept term (which is automatically included) must not be removed.
The distributional assumptions associated to the response
and selection
components
are specified by the arguments resp.dist
and select.dist
, respectively.
Argument select.dist
refers to the unobservable continuous variable of which we
observe only the dichotomous outcome Yes-No.
In this respect, a remark is appropriate about the option "Gumbel"
for select.dist
.
This choice is equivalent to the adoption of an Exponential distribution of the selection variables
combined an exponential transformation of the linear predictor of the
selection
argument, as it is presented in Section 3.2 of Azzalini et al. (2019).
Also, it corresponds to work with the log-transformation of an Exponential variable,
which is essentially a Gumbel type of variable, up to a linear transformation with
respect to its more commonly employed parameterization.
When resp.dist
is "Poisson"
or "NegBinomial"
and trunc.num
is missing,
a default choice is made; this equals 1.5*m
or 2*m
in the two respective cases,
where m
denotes the maximum observed value of the response variable.
Function DiSSMOd
calls lower level functions, nr.bin, nr.nbinom, nr.pois
and the others
for the actual numerical maximization of the log-likelihood via a Newton-Raphson iteration.
Notice that the automatic initialization of the alpha
search interval, when this argument is
missing, may change in future versions of the package.
Azzalini, A., Kim, H.-M. and Kim, H.-J. (2019) Sample selection models for discrete and other non-Gaussian response variables. Statistical Methods & Applications, 28, 27--56. First online 30 March 2018. https://doi.org/10.1007/s10260-018-0427-1
The functions summary.DiSSMod
, coef.DiSSMod
,
confint.DiSSMod
, plot.DiSSMod
are used to obtain and print a summary, coefficients, confidence interval and
plot of the results.
The generic function logLik
is used to obtain maximum log likelihood of the
result.
# NOT RUN {
set.seed(45)
data(DoctorRWM, package = "DiSSMod")
n0 <- 600
set.n0 <- sample(1:nrow(DoctorRWM), n0)
reduce_DoctorRWM <- DoctorRWM[set.n0,]
result0 <- DiSSMod(response = as.numeric(DOCVIS > 0) ~ AGE + INCOME_SCALE + HHKIDS + EDUC + MARRIED,
selection = PUBLIC ~ AGE + EDUC + FEMALE,
data = reduce_DoctorRWM, resp.dist="bernoulli", select.dist = "normal",
alpha = seq(-5.5, -0.5, length.out = 21), standard = TRUE)
print(result0)
data(CreditMDR, package = "DiSSMod")
n1 <- 600
set.n1 <- sample(1:nrow(CreditMDR), n1)
reduce_CreditMDR <- CreditMDR[set.n1,]
result1 <- DiSSMod(response = MAJORDRG ~ AGE + INCOME + EXP_INC,
selection = CARDHLDR ~ AGE + INCOME + OWNRENT + ADEPCNT + SELFEMPL,
data = reduce_CreditMDR, resp.dist="poi", select.dist = "logis",
alpha = seq(-0.3, 0.3,length.out = 21), standard = FALSE, verbose = 1)
print(result1)
# }
Run the code above in your browser using DataCamp Workspace