Transcription of boxcox — Box–Cox regression models
1 Box Cox regression modelsDescriptionQuick startMenuSyntaxOptionsRemarks and examplesStored resultsMethods and formulasReferencesAlso seeDescriptionboxcoxfinds the maximum likelihood estimates of the parameters of the Box Cox transform,the coefficients on the independent variables, and the standard deviation of the normally distributederrors. Anydepvarorindepvarsto be transformed must be strictly positive. Options can be used tocontrol which variables remain startBox Cox transform ofyin a model ofyas a function ofx1boxcox y x1 Same as aboveboxcox y x1, model(lhsonly)Likelihood-ratio test for each scale-variant parameterboxcox y x1, lrtestDifferent transform for each side and adding covariatesx2andx3boxcox y x1 x2 x3, model(theta)Same transform for both sides, and includex3as an untransformed variable transformationboxcox y x1 x2, model(lambda) notrans(x3)
2 MenuStatistics>Linear models and related>Box Cox regression12 boxcox Box Cox regression modelsSyntaxboxcoxdepvar[indepvars] [if] [in] [weight] [,options]optionsDescriptionModelnoconst antsuppress constant termmodel(lhsonly)left-hand-side Box Cox model; the defaultmodel(rhsonly)right-hand-side Box Cox modelmodel(lambda)both sides Box Cox model with same parametermodel(theta)both sides Box Cox model with different parametersnotrans(varlist)do not transform specified independent variablesReportinglevel(#)set confidence level; default islevel(95)lrtestperform likelihood-ratio testMaximization[no]logsuppress all iteration logsnologlrsuppress restricted-modellrtestiteration logmaximizeoptionscontrol the maximization process; seldom useddepvarandindepvarsmay contain time-series operators; see[U] Time-series ,by,collect,jackknife,rolling,statsby, andxiare allowed; see[U] Prefix are not allowed with thebootstrapprefix; see [R] andiweights are allowed; see[U] [U] 20 Estimation and postestimation commandsfor more capabilities of estimation Model noconstant.
3 See [R]Estimation ( lhsonly|rhsonly|lambda|theta )specifies which of the four models to (lhsonly)applies the Box Cox transform (lhsonly)is the (rhsonly)applies the transform to (lambda)applies the transform to bothdepvarandindepvars, and they are transformed bythe same (theta)applies the transform to bothdepvarandindepvars, but this time, each side istransformed by a separate (varlist)specifies that the variables invarlistnot be transformed when included in themodel. You can specifynotrans(varlist)withmodel(lhsonly ), but the results will be the sameas specifying the variables invarlistinindepvars.
4 Reporting level(#); see [R]Estimation Box Cox regression models 3lrtestspecifies that a likelihood-ratio test of significance be performed and reported for eachindependent variable. Maximization logandnologspecify whether to display the iteration log. The iteration log is displayed by defaultunless you usedset iterlog offto suppress it; seeset iterlogin [R]set iter. These optionscontrol the iteration log produced by the full model and, if optionlrtestis specified, by thefitted restricted the iteration log when fitting the restricted models required by :iterate(#)andfrom(initspecs).
5 See [R] value specificationlhsonly from( 0, copy)rhsonly from( 0, copy)lambda from( 0, copy)theta from( 0 0, copy)Remarks and are presented under the following headings:IntroductionTheta modelLambda modelLeft-hand-side-only modelRight-hand-side-only modelIntroductionThe Box Cox transformy( )=y 1 has been widely used in applied data analysis. Box and Cox (1964) developed the transformation andargued that the transformation could make the residuals more closely normal and less and Weisberg (1982) discuss the transform in this light. Because the transform embeds severalpopular functional forms, it has received some attention as a method for testing functional forms, inparticular,y( )= y 1if = 1ln(y)if = 01 1/yif = 1 Davidson and MacKinnon (1993) discuss this use of the transform.
6 Atkinson (1985) also gives a goodgeneral boxcox Box Cox regression modelsTheta modelboxcoxobtains the maximum likelihood estimates of the parameters for four different most general of the models , thethetamodel, isy( )j= 0+ 1x( )1j+ 2x( )2j+ + kx( )kj+ 1z1j+ 2z2j+ + lzlj+ jwhere N(0, 2). Here the dependent variable,y, is subject to a Box Cox transform withparameter .Each of theindepvars,x1,x2,..,xk, is transformed by a Box Cox transform withparameter . Thez1,z2,..,zlspecified in thenotrans()option are independent variables that arenot and Cox (1964) argued that this transformation would leave behind residuals that more closelyfollow a normal distribution than those produced by a simple linear regression model.
7 Bear in mindthat the normality of is assumed and thatboxcoxobtains maximum likelihood estimates of thek+l+4 parameters under this not choose and so that the residuals areapproximately normally distributed. If you are interested in this type of transformation to normality,see the official Stata commandslnskew0andbcskew0in [R]lnskew0. However, those commandswork on a more restrictive model in which none of the independent variables is 1 Below, we fit athetamodel to a nonrepresentative extract of the Second National Health andNutrition Examination Survey (NHANES II) dataset discussed in McDowell et al.
8 (1981).We model individual-level diastolic blood pressure (bpdiast) as a function of the transformedvariables body mass index (bmi) and cholesterol level (tcresult) and of the untransformed variablesage (age) and sex (sex). boxcox Box Cox regression models 5. use boxcox bpdiast bmi tcresult, notrans(age sex) model(theta) lrtestFitting comparison modelIteration 0: log likelihood = 1: log likelihood = 2: log likelihood = 3: log likelihood = full modelIteration 0: log likelihood = 1: log likelihood = 2: log likelihood = 3: log likelihood = comparison models for LR testsIteration 0: log likelihood = 1: log likelihood = 2: log likelihood = 3: log likelihood = 0: log likelihood = 1: log likelihood = 2: log likelihood = 0: log likelihood = 1: log likelihood = 2.
9 Log likelihood = 3: log likelihood = 0: log likelihood = 1: log likelihood = 2: log likelihood = of obs = 10,351LR chi2(5) = likelihood = Prob > chi2 = Std. err. z P>|z| [95% conf. interval] .1577601 .3291245 .9475327 .0454088 .1098201 .2878193 Estimates of scale-variant parametersCoefficient chi2(df) P>chi2(df) df of 1 RestrictedH0: log likelihood chi2 Prob > chi2theta=lambda = -1 = 0 = 1 boxcox Box Cox regression modelsThe output is composed of the iteration logs and three distinct tables.
10 The first table containsa standard header for a maximum likelihood estimator and a standard output table for the Box Cox transform parameters. The second table contains the estimates of the scale-variant third table contains the output from likelihood-ratio tests on three standard functional right-hand-side and the left-hand-side transformations each add to the regression fit at the 1%significance level and are both positive but less than 1. All the variables have significant impacts ondiastolic blood pressure,bpdiast. As expected, the transformed variables the body mass index,bmi, and cholesterol level,tcresult contribute to higher blood pressure.