Transcription of Title stata.com robust — Robust variance estimates
1 Robust variance estimatesSyntaxDescriptionOptionsRemarks and examplesStored resultsMethods and formulasReferencesAlso seeSyntaxrobustvarlist[if] [in] [weight] [, variance (matname) minus(#)strata(varname) psu(varname) cluster(varname) fpc(varname)subpop(varname) vsrs(matname) srssubpop zeroweight]robustworks with models that have all types of varlists, including those with factor variables and time-seriesoperators; see[U] Factor variablesand[U] Time-series ,aweights,fweights, andiweights are allowed; see[U] implement estimation commands and is rarely used. That is because other commandsare implemented in terms of it and are easier and more convenient to use. For instance, if all youwant to do is make your estimation command allow thevce( Robust )andvce(clusterclustvar)opt ions, see [R]ml.
2 If you want to make your estimation command work with survey data, it is easierto make your command work with thesvyprefix see [P]program properties rather than to you really want to understand whatmlandsvyare doing, however, this is the section for , if you have an estimation problem that does not fit with themlorsvyframework, thenrobustmay be able to a programmer s command that computes a Robust variance estimator based on avarlist of equation-level scores and a covariance matrix. It produces estimators for ordinary data (eachobservation independent), clustered data (data not independent within groups, but independent acrossgroups), and complex survey data from one stage of stratified cluster Robust variance estimator goes by many names: Huber/White/sandwich are typically used inthe context of robustness against heteroskedasticity.
3 Survey statisticians often refer to this variancecalculation as a first-order Taylor-series linearization method. Despite the different names, the estimatoris the equation-level score variables (varlist) consist of one variable for single-equation models ormultiple variables for multiple-equation models, one variable for each equation. The covariance matrix before adjustment is either posted usingereturn post(see [P]ereturn) or specified with thevariance(matname)option. In the former case,robustreplaces the covariance in the post withthe Robust covariance matrix. In the latter case, the matrixmatnameis overwritten with the robustcovariance matrix. Note: The Robust covariance formula isV=DMD, whereDis what we arecalling the covariance matrix before adjustment; this is not always a true covariance.
4 SeeRemarksand reading this section, you should be familiar with[U] Obtaining Robust varianceestimatesand theMethods and formulassection of [R]regress. We assume that you have alreadyprogrammed an estimator in Stata and now wish to have it compute Robust variance estimates . If youhave not yet programmed your estimator, see[U] 18 Programming Stata, [R]ml, and [P] Robust variance estimatesIf you wish to program an estimator for survey data, then you should write the estimator fornonsurvey data first and then use the instructions in [P]program properties(making programssvyable) to get your estimation command to work properly with thesvyprefix. See [SVY]varianceestimationfor a discussion of variance estimation for survey (matname)specifies a matrix containing the unadjusted covariance matrix, that is, theDinV=DMD.
5 The matrix must have its rows and columns labeled with the appropriatecorresponding variable names, that is, the names of thex s inx . If there are multiple equations,the matrix must have equation names; see [P]matrix rownames. TheDmatrix is overwrittenwith the Robust covariance matrixV. Ifvariance()is not specified, Stata assumes thatDhasbeen posted usingereturn post;robustwill then automatically post the Robust covariancematrixVand (#)specifiesk=#for the multipliern/(n k)of the Robust variance estimator. Stata smaximum likelihood commands usek=1, and so does , vce( Robust )uses, by default, this multiplier withkequal to the number of explanatory variables in the model,including the constant. The default isk=1.
6 SeeMethods and formulasfor (varname)specifies the name of a variable (numeric or string) that contains stratum (varname)specifies the name of a variable (numeric or string) that contains identifiers for theprimary sampling unit (PSU).psu()andcluster()are synonyms; they both specify the (varname)is a synonym forpsu().fpc(varname)requests a finite population correction for the variance estimates . If the variable specifiedhas values less than or equal to 1, it is interpreted as a stratum sampling ratefh=nh/Nh,wherenhis the number ofPSUs sampled from stratumhandNhis the total number ofPSUsin the population belonging to stratumh. If the variable specified has values greater than 1, it isinterpreted as (varname)specifies that estimates be computed for the single subpopulation defined by theobservations for whichvarname6=0 (and is not missing).
7 This option would typically be usedonly with survey data; see [SVY]subpopulation (matname)creates a matrix containing Vsrswor, an estimate of the variance that would havebeen observed had the data been collected using simple random sampling without is used to compute design effects for survey data; see [SVY]estatfor be specified only ifvsrs()andsubpop()are thatthe estimate of simple-random-sampling variance ,vsrs(), be computed assuming sampling withina subpopulation. Ifsrssubpopis not specified, it is computed assuming sampling from the whether observations with weights equal to zero should be omitted from thecomputation. This option does not apply to frequency weights; observations with zero frequencyweights are always omitted.
8 Ifzeroweightis specified, observations with zero weights areincluded in the computation. Ifzeroweightis not specified (the default), observations with zeroweights are omitted. Including the observations with zero weights affects the computation in thatit may change the counts ofPSUs (clusters) per stratum. Stata ssvyprefix command includesobservations with zero weights; all other commands exclude them. This option is typically usedonly with survey Robust variance estimates 3 Remarks and are presented under the following headings:IntroductionClustered dataSurvey dataControlling the header displayMaximum likelihood estimatorsMultiple-equation estimatorsIntroductionThis section explains the formulas behind the Robust variance estimator and how to userobustthrough an informal development with some simple examples.
9 For an alternative discussion, see[U] Obtaining Robust variance estimates . See the references cited at the end of this entry formore formal , consider ordinary least-squares regression. The estimator for the coefficients is = (X X) 1X ywhereyis ann 1 vector representing the dependent variable andXis ann kmatrix of everything is considered conditional onX,(X X) 1can be regarded as a constant , the variance of isV( ) = (X X) 1V(X y) (X X) 1 What is the variance ofX y, ak 1 vector? Look at its first element; it isX 1y=x11y1+x21y2+ +xn1ynwhereX1is the first column ofX. BecauseXis treated as a constant, you can write the variance asV(X 1y) =x211V(y1) +x221V(y2) + +x2n1V(yn)The only assumption made here is that theyjare obvious estimate forV(yj)is e2j, the square of the residual ej=yj xj , wherexjis thejth row ofX.
10 You must estimate the off-diagonal terms of the covariance matrix forX y, as this out, you have V(X y) =n j=1 e2jx jxjxjis defined as a row vector so thatx jxjis ak have just derived the Robust variance estimator for linear regression coefficient estimates forindependent observations: V( ) = (X X) 1(n j=1 e2jx jxj)(X X) 1 You can see why it is called the sandwich Robust variance estimatesTechnical noteThe only detail not discussed is the multiplier. You will see later that survey statisticians like toview the center of the sandwich as a variance estimator for totals. They use a multiplier ofn/(n 1),just as 1/(n 1)is used for the variance estimator of a mean. However, for survey data,nis nolonger the total number of observations but is the number of clusters in a stratum.