{smcl} {* 13.06.2005}{...} {hline} help for {hi:ssm}{right:(SJ6-3: st0107)} {hline} {title:Endogenous switch and sample selection count, binary, and ordinal response regression} {p 8 12 2}{cmd:ssm} {it:depvar} [{it:indepvars}] {ifin} {weight}{cmd:,} {cmdab:s:witch}{cmd:(}{it:varname} = {it:varlist}{cmd:)} {cmdab:f:amily}{cmd:(}{it:familyname}{cmd:)} {cmdab:l:ink}{cmd:(}{it:linkname}{cmd:)} [{cmdab:q:uadrature}{cmd:(}{it:#}{cmd:)} {cmdab:sel:ection} {cmdab:nocons:tant} {cmd:adapt} {cmdab:r:obust} {cmdab:com:mands} {cmdab:nolo:g} {cmdab:tr:ace} {cmdab:fr:om:(}{it:matrix}{cmd:)}] {p 4 4 2} {cmd:fweight}s and {cmd:pweight}s are allowed; see {help weight}. {p 4 4 2} The outcome model is specified by {it:depvar} and [{it:indepvars}], {cmd:family}{cmd:(}{it:familyname}{cmd:)}, {cmd:link}{cmd:(}{it:linkname}{cmd:)}, etc. {p 4 4 2} The endogenous switching equation is specified by {cmdab:s:witch}{cmd:(}{it:varname} = {it:varlist}{cmd:)}, where {it:varname} is the name of the endogenous dummy variable and {it:varlist} are a set of explanatory variables. Endogenous switching models are the default specification. Sample selection models are obtained if the {cmd:selection} option is used. {p 4 4 2} {it:familyname} is one of {p 8 8 2}{cmdab:bin:omial} | {cmdab:poi:sson} {p 4 4 2} {it:linkname} is one of {p 8 8 2}{cmd:log} | {cmdab:l:ogit} | {cmdab:pro:bit} | {cmdab:olog:it} | {cmdab:opro:bit} {p 4 4 2} {cmd:ssm} shares the features of all estimation commands; see help {help estcom}. {title:Description} {p 4 4 2} {cmd:ssm} is a wrapper for {helpb gllamm} to estimate endogenous switch and sample selection count, binary, and ordinal response regression by maximum likelihood using adaptive quadrature. {cmd:ssm} interprets a simple syntax, prepares the data for {cmd:gllamm}, calls {cmd:gllamm}, and produces tailor-made output. The {cmd:commands} option causes {cmd:ssm} to print all data manipulation commands and the {cmd:gllamm} command. {cmd:gllamm} itself should be used to extend the model and for prediction and simulation using {helpb gllapred} or {helpb gllasim}. The endogenous switch (sample selection) model comprises two submodels: the outcome model and the switch (selection) model. {p 4 4 2} The outcome model is a generalized linear model that contains an endogenous dummy variable among its observed covariates and a unobserved or latent random term. {p 4 4 2} The switch model is a binary variable model that determines the outcome of the endogenous dummy included in the outcome model. The switch model contains an unobserved random (latent) term that is correlated with the unobserved random term included in the outcome model. {p 4 4 2} The selection model is obtained when the outcome variable is only observed if a particular condition is met (selection = 1) and the selection dummy does not enter the outcome model. {title:Options} {phang} {opt switch(varname = varlist)} specifies the switching equation, where {it:varname} is the name of the endogenous dummy and {it:varlist} is a set of explanatory variables. {p 4 8 2} {cmd:family}{cmd:(}{it:familyname}{cmd:)} specifies the distribution of {it:depvar}. {p 4 8 2} {cmd:link}{cmd:(}{it:linkname}{cmd:)} specifies the link function. {p 4 8 2} {cmd:quadrature}{cmd:(}{it:#}{cmd:)} specifies the number of quadrature points to be used. {p 4 8 2} {cmd:selection} specifies that a sample selection models be fitted instead of the default endogenous switching specification. {p 4 8 2} {cmd:noconstant} specifies that the linear predictor has no intercept term, thus forcing it through the origin on the scale defined by the link function. {p 4 8 2} {cmd:adapt} specifies that adaptive quadrature is to be used instead of the default ordinary quadrature. {p 4 8 2} {cmd:robust} specifies that the Huber/White/sandwich estimator of variance is to be used. If {cmd:pweight}s are specified, {cmd:robust} is implied. {p 4 8 2} {cmd:commands} displays the commands necessary to prepare the data and fits the model in {cmd:gllamm} instead of fitting the model with {cmd:ssm}. These commands can be copied into a do-file and should work without further editing. The do-file will change the data. {p 4 8 2} {cmd:nolog} suppresses the iteration log. {p 4 8 2} {cmd:trace} requests that the estimated coefficient vector be printed at each iteration. Also all the output produced by {cmd:gllamm} with the {cmd:trace} option is produced. {p 4 8 2} {cmd:from}{cmd:(}{it:matrix}{cmd:)} specifies a matrix of starting values. {title:Remarks} {p 4 4 2} The allowed link functions are {center:Link function {cmd:ssm} option } {center:{hline 40}} {center:log {cmd:link(log)} } {center:logit {cmd:link(logit)} } {center:probit {cmd:link(probit)} } {center:ordinal logit {cmd:link(ologit)} } {center:ordinal probit {cmd:link(oprobit)} } {p 4 4 2} The allowed distribution families are {center:Family {cmd:ssm} option } {center:{hline 40}} {center:Bernoulli/binomial {cmd:family(binomial)} } {center:Poisson {cmd:family(poisson)} } {p 4 4 2} If you specify {cmd:family()} but not {cmd:link()}, you obtain the canonical link for the family: {center:{cmd:family()} default {cmd:link()}} {center:{hline 38}} {center:{cmd:family(binomial)} {cmd:link(logit)} } {center:{cmd:family(poisson)} {cmd:link(log)} } {title:Examples} {p 4 8 2}{cmd:* simulate data}{p_end} {p 4 8 2}set seed 12345678{p_end} {p 4 8 2}set obs 3500{p_end} {p 4 8 2}local lambda = 0.4{p_end} {p 4 8 2}gen double ve = invnorm(uniform()){p_end} {p 4 8 2}gen double zeta = invnorm(uniform()){p_end} {p 4 8 2}gen double tau = invnorm(uniform()){p_end} {p 4 8 2}gen double x1=invnorm(uniform()){p_end} {p 4 8 2}gen double x2=invnorm(uniform()){p_end} {p 4 8 2}gen double x3=invnorm(uniform()){p_end} {p 4 8 2}gen double x4=invnorm(uniform()){p_end} {p 4 8 2}gen selstar = 0.58 + 0.93*x1 + 0.45*x2 - 0.64*x3 + 0.6*x4 + (ve + zeta)/sqrt(2){p_end} {p 4 8 2}gen double sel = (selstar>0){p_end} {p 4 8 2}gen double ystar = 0.30*x1 + 0.11*x2 + (`lambda'*ve + tau)/sqrt(1+`lambda'^2){p_end} {p 4 8 2}gen double ordvar = 0{p_end} {p 4 8 2}qui replace ordvar=1 if ystar>-0.40 & ystar<=0.17{p_end} {p 4 8 2}qui replace ordvar=2 if ystar>0.17 & ystar<=0.45{p_end} {p 4 8 2}qui replace ordvar=3 if ystar>0.45 & ystar<=0.80{p_end} {p 4 8 2}qui replace ordvar=4 if ystar>0.80 & ystar<=1.25{p_end} {p 4 8 2}qui replace ordvar=5 if ystar>1.25{p_end} {p 4 8 2}replace ordvar=. if sel==0{p_end} {p 4 8 2}{cmd:* estimate model}{p_end} {p 4 8 2}. ssm y x1 x2, s(sel = x1 x2 x3 x4) q(15) fam(bin) link(probit) sel{p_end} {title:Web site} {p 4 13 2} http://www.gllamm.org {title:Authors} {phang} Alfonso Miranda (A.Miranda@econ.keele.ac.uk) and{break} Sophia Rabe-Hesketh (sophiarh@berkeley.edu). {title:References} {phang} Miranda, A., and M. Bratti. 2006. Non-pecuniary returns to higher education: The effect on smoking intensity in the UK. IZA Discussion Paper No. 2090. {phang} Miranda, A., and S. Rabe-Hesketh. 2005. Maximum likelihood estimation of endogenous switching and sample selection models for binary, ordinal, and count variables. Manuscript. {phang} Rabe-Hesketh, S., A. Pickles, and A. Skrondal. 2001. Correcting for covariate measurement error in logistic regression using nonparametric maximum likelihood estimation. {it:Statistical Modelling} 3: 215-232. {phang} Rabe-Hesketh, S., A. Pickles, and A. Skrondal. 2001. {it:GLLAMM Manual}. Technical Report 2001/01, Department of Biostatistics and Computing, Institute of Psychiatry, King's College, London. http://www.gllamm.org. {phang} Rabe-Hesketh, S., A. Skrondal, and A. Pickles. 2002. Reliable estimation of generalized linear mixed models using adaptive quadrature. {it:Stata Journal} 2: 1-21. {phang} Rabe-Hesketh, S., A. Skrondal, and A. Pickles. 2003. Maximum likelihood estimation of generalized linear models with covariate measurement error. {it:Stata Journal} 3: 385-410. {phang} Rabe-Hesketh, S., A. Skrondal, and A. Pickles. 2004. Generalized multilevel structural equation modeling. Psychometrika, in press. {title:Also see} {p 4 13 2} Manual: {hi:[U] 23 Estimation and post-estimation commands},{break} {hi:[U] 29 Overview of Stata estimation commands},{break} {p 4 13 2} Online: {helpb cme}; {helpb gllamm}, {helpb gllapred}, {helpb gllasim}; {help estcom}, {help postest}; {helpb cloglog}, {helpb logistic}, {helpb poisson}, {helpb regress} {p_end}