# copulaSampleSel: Semiparametric Copula Bivariate Regression Models with... In SemiParBIVProbit: Semiparametric Copula Regression Models

## Description

copulaSampleSel fit flexible copula bivariate sample selection models with several types of covariate effects, copula distributions and marginal distributions.

## Usage

 1 2 3 4 5 copulaSampleSel(formula, data = list(), weights = NULL, subset = NULL, BivD = "N", margins = c("probit", "N"), dof = 3, fp = FALSE, infl.fac = 1, rinit = 1, rmax = 100, iterlimsp = 50, tolsp = 1e-07, gc.l = FALSE, parscale, extra.regI = "t")

## Arguments

 formula In the basic setup, this will be a list of two formulas, one for equation 1 and the other for equation 2. s terms are used to specify smooth functions of predictors. For the case of more than two equations see the example below and the documentation of SemiParBIVProbit() for more details. Note that the first formula MUST refer to the selection equation. data An optional data frame, list or environment containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which copulaSampleSel is called. weights Optional vector of prior weights to be used in fitting. subset Optional vector specifying a subset of observations to be used in the fitting process. margins It indicates the distributions used for the two margins. The first is one of "probit", "logit", "cloglog" which refer to the link function of the first equation whose response is always assumed to be binary. The response for the second equation can be normal ("N"), normal where sigma2 corresponds to the standard deviation instead of the variance ("N2"), log-normal ("LN"), Gumbel ("GU"), reverse Gumbel ("rGU"), logistic ("LO"), Weibull ("WEI"), inverse Gaussian ("iG"), gamma ("GA"), Dagum ("DAGUM"), Singh-Maddala ("SM"), beta ("BE"), Fisk ("FISK", also known as log-logistic distribution), Poisson ("PO"), zero truncated Poisson ("ZTP"), negative binomial - type I ("NBI"), negative binomial - type II ("NBII"), Poisson inverse Gaussian ("PIG"). dof If BivD = "T" then the degrees of freedom can be set to a value greater than 2 and smaller than 249. BivD Type of bivariate error distribution employed. Possible choices are "N", "C0", "C90", "C180", "C270", "J0", "J90", "J180", "J270", "G0", "G90", "G180", "G270", "F", "AMH", "FGM", "T", "PL", "HO" which stand for bivariate normal, Clayton, rotated Clayton (90 degrees), survival Clayton, rotated Clayton (270 degrees), Joe, rotated Joe (90 degrees), survival Joe, rotated Joe (270 degrees), Gumbel, rotated Gumbel (90 degrees), survival Gumbel, rotated Gumbel (270 degrees), Frank, Ali-Mikhail-Haq, Farlie-Gumbel-Morgenstern, Student-t with fixed dof, Plackett, Hougaard. fp If TRUE then a fully parametric model with unpenalised regression splines if fitted. See the example below. infl.fac Inflation factor for the model degrees of freedom in the approximate AIC. Smoother models can be obtained setting this parameter to a value greater than 1. rinit Starting trust region radius. The trust region radius is adjusted as the algorithm proceeds. See the documentation of trust for further details. rmax Maximum allowed trust region radius. This may be set very large. If set small, the algorithm traces a steepest descent path. iterlimsp A positive integer specifying the maximum number of loops to be performed before the smoothing parameter estimation step is terminated. tolsp Tolerance to use in judging convergence of the algorithm when automatic smoothing parameter estimation is used. gc.l This is relevant when working with big datasets. If TRUE then the garbage collector is called more often than it is usually done. This keeps the memory footprint down but it will slow down the routine. parscale The algorithm will operate as if optimizing objfun(x / parscale, ...) where parscale is a scalar. If missing then no rescaling is done. See the documentation of trust for more details. extra.regI If "t" then regularization as from trust is applied to the information matrix if needed. If different from "t" then extra regularization is applied via the options "pC" (pivoted Choleski - this will only work when the information matrix is semi-positive or positive definite) and "sED" (symmetric eigen-decomposition).

## Details

The underlying algorithm is based on an extension of the procedure used for SemiParBIVProbit(). For more details see ?SemiParBIVProbit.

This function works as SemiParSampleSel() in SemiParSampleSel and has been included in SemiParBIVProbit (which already included sample selection models for binary outcomes) for the user's convenience (given several requests). copulaSampleSel() allows for several continuous/discrete distributions and link functions for the selection equation. SemiParSampleSel() allows for a probit link, normal, gamma and several discrete distributions.

If there are factors in the model, before fitting, the user has to ensure that the numbers of factor variables' levels in the selected sample are the same as those in the complete dataset. Even if a model could be fitted in such a situation, the model may produce fits which are not coherent with the nature of the correction sought. For more details see ?SemiParBIVProbit.

There are many continuous/discrete distributions and copula functions to choose from and we plan to include more options. Get in touch if you are interested in a particular distribution.

## Value

The function returns an object of class copulaSampleSel as described in copulaSampleSelObject.

## WARNINGS

Convergence can be checked using conv.check which provides some information about the score and information matrix associated with the fitted model. The former should be close to 0 and the latter positive definite. SemiParBIVProbit() will produce some warnings if there is a convergence issue.

Convergence failure may sometimes occur. This is not necessarily a bad thing as it may indicate specific problems with a fitted model. In such a situation, the user may use some extra regularisation (see extra.regI) and/or rescaling (see parscale). However, the user should also consider re-specifying/simplifying the model and/or using a diferrent dependence structure and/or checking that the chosen marginal distributions are adequate. In our experience, we found that convergence failure typically occurs when the model has been misspecified and/or the sample size/number of selected observations is low compared to the complexity of the model. Examples of misspecification include using a Clayton copula rotated by 90 degrees when a positive association between the margins is present instead, using marginal distributions that do not fit the responses or that contain many parameters, and employing a copula which does not accommodate the type and/or strength of the dependence between the margins (e.g., using AMH when the association between the margins is strong). When using smooth functions, if the covariate's values are too sparse then convergence may be affected by this. It is also worth bearing in mind that the use of a three parameter marginal distribution requires the data to be more informative than a situation in which a two parameter distribution is used instead.

Extra attention is required when specifying the dependence parameter as a function of covariates. This is because in these situations the dependence parameter mainly models the association between the unobserved confounders in the two equations. Therefore, this option would make sense when it is believed that the strength of the association between the unobservables in the two equations varies based on some grouping factor or across geographical areas, for instance.

## Author(s)

Maintainer: Giampiero Marra [email protected]

## References

Marra G. and Radice R. (2013), Estimation of a Regression Spline Sample Selection Model. Computational Statistics and Data Analysis, 61, 158-173.

Marra G. and Wyszynski K. (2016), Semi-Parametric Copula Sample Selection Models for Count Responses. Computational Statistics and Data Analysis, 104, 110-129.

Wojtys M. and Marra G. (submitted). Copula-Based Generalized Additive Models with Non-Random Sample Selection.