ISSN 089-64 ISBN 978 0 7340 405 THE UNIVERSITY OF MELBOURNE DEPARTMENT OF ECONOMICS RESEARCH PAPER NUMBER 06 January 009 Notes on the Construction of Geometric Representations of Confidence Intervals of Ratios using Stata, Gauss and Eviews y Joe Hirscherg and Jenny Lye Department of Economics The University of Melourne Melourne Victoria 300 Australia.
Notes on the Construction of Geometric Representations of Confidence Intervals of Ratios using Stata, Gauss and Eviews Joe Hirscherg and Jenny Lye January 09 Astract: These notes demonstrate how one can define optimization prolems whose solutions can e interpreted as the Delta and the Fieller confidence intervals for a ratio of normally distriuted parameter estimates. Also included in these notes are the details of the derivation of the slope of a constraint ellipse that is common to oth optimizations. In addition, these notes provide an example of how one might generate a graphic representation of oth optimization prolems using the Stata, Gauss and Eviews statistical computer programs. Key words: Fieller method, Delta method, marginal ellipse Joe Hirscherg and Jenny Lye are Associate Professors in the Department of Economics, University of Melourne, Melourne, 300, Australia. (j.hirscherg@unimel.edu.au, jnlye@unimel.edu.au) We wish to thank the Department of Economics and Finance of La Troe University and the Faculty of Economics and Commerce of The University of Melourne for partial support of this research.
. Introduction A statistic defined as the ratio of two normally distriuted random variales is often encountered in applied work. The Delta method has een nominated as the most common technique for drawing inferences for such nonlinear cominations. The primary alternative for the computation of the confidence intervals of ratios is the Fieller method (or theorem) (93, 944, and 954) which is derived from the properties of a ratio of ivariate normally distriuted random variales (see Marsaglia (965) and Hinkley (969) for a detailed discussion of these cases and Zere (978) for an application to the general linear model). In these notes we demonstrate the derivation of the two optimization prolems whose solutions are these ounds as well as the slope of the constraint ellipse. We also present an example of how the constraint ellipse may e constructed geometrically with a numer of widely availale computer programs. This paper provides details for the analysis given in Hirscherg and Lye (009).. The Delta confidence interval for a ratio of parameter estimates as the solution to an optimization prolem. It can e shown that the 00(-α)% confidence interval for a linear comination of a vector of normally distriuted random variales is the solution to the constrained optimization prolem as proposed y Durand (954) and Scheffé (959 appendix III) L () z aβ c β-b Σ β-b In the general case of a linear comination of a k dimensional normally distriuted random vector: k k kk B ~ N β, Σ () Σ is assumed non-singular and the linear comination is defined as aβ c and a is a k constant vector and c is a constant. We propose that the 00% confidence interval for the
estimate of ˆ aβ c can e found from the solution to the constrained optimization defined y (). Where z is the appropriate z-statistic for the 00% confidence ound (i.e. for 05 z 96), and variale with one degree of freedom. z the square of which is equivalent to a chi-square distriuted random Taking the first derivatives of L with respect to the parameters and the multiplier and setting them equal to zero we find the following first order conditions which can e solved for the optimal values β and : L a Σ β B 0 β (3a) L - β B Σ β B z 0 (3) Rewriting (3a) we find that: (4) β B ½ Σa Which can then e sustituted into (3) to solve for - ¼ : ¼ - z a Σa (5) By definition the covariance matrix is positive semi-definite thus aσa 0 and we can take the square root of oth sides of (5) to otain two values for ½ z aσa - ½ - : -½. By adding B to oth sides of (4) we find the optimal value of β from:. By pre-multiplying oth sides of this β B ½ Σa equation y a and then sustituting for the optimal value of - ½ we can now find an expression for the optimal value of the constrained linear comination defined as: aβ c as: ab c zaσa ½ (6) Which is the usual expression for the ( )00% confidence interval of a linear comination of multivariate normally distriuted random variales. In the case of the Delta approximation applied to the ratio of parameters we have that the 3
approximation is given y the linear comination: ˆ ˆ ˆ (7) Where ˆ and N, ~ we then otain an optimization in two dimensions y application of equation () as: L (8) ˆ z ˆ 3. The Fieller confidence interval for a ratio of parameter estimates as the solution to an optimization prolem. Following the form of the discussion in Von Luxurg and Franz (004) the ounds of the ratio of the means where the restriction is defined y the confidence ellipsoid of the two parameters can e found from the solution to the following constrained optimization prolem: If we sustitute z L (9) (9) can e written as: ij as the elements of the inverse of the covariance and use and L (0) z The first order partial derivatives of L with respect to,, and evaluated at the optimal values defined as,, and : L (a) 4
L z () L (c) The first order conditions for an optimum are given y setting these partial derivatives to zero. First we can solve (c) for. Then we sustitute for in () which results in a quadratic equation in. The roots of this quadratic are given y: ½ z z z 3 i z () Alternatively, the Fieller method is defined as the solution for the values of as: ½ z ² z ² i z z z (3) Using the correspondence etween the covariance matrix and its inverse defined as: (4) We can show that the roots for the constrained optimization prolem solution in () are equal to the expression (3). 4. The determination of the slope of the constraint ellipse evaluated at the estimated values. Following Marks (98) we derive the slope of tangents to the constraint ellipse defined y: 0 z (5) Solving this quadratic for we otain: z (6) where and are the estimated parameters regression parameters, and ij are elements of the inverse of the covariance of the z is the critical value of the Normal distriution for a two tailed test. 5
Define the elements of the inverse of the covariance matrix in terms of the correlation coefficient given as: And take the first derivative of with respect to the value of we define the slope of the ellipse as: t (7) Which when evaluated at the estimate results in:. 5. An example of the construction of the constraint ellipse using Stata, Gauss, and Eviews. The data for this example is the file californian.dta and from Stock and Watson s text (007, p. 4). The data is for 40 school districts in the year 998 on the average fifth grade test scores (y) and the average annual per capita income in the school district measured in tens of thousands of 998 dollars (z). The regression of interest is: 0 y z z (8) The ratio of interest in this example is the turning point of the quadratic function which determines the level of income per capita at which the relationship etween test scores and income changes sign. This level of income is defined as: (9) The standard 00(- )% joint confidence ellipse produced in most packages that plot ellipses is specified as ˆ ˆ cov ˆ F, T K δ δ δ δ δ (0) 6
where δ and ˆδ is the corresponding OLS estimate. However, the marginal 00(- )% confidence ellipse as defined for the optimizations defined in (needed to otain the Fieller interval for ) is given y: ˆ ˆ cov ˆ F, T K δ δ δ δ δ () The marginal 00(- )% confidence ellipse can e otained from (0) y specifying an equivalent confidence level such that F T K F T K,,. The Tale elow lists the appropriate confidence levels to use in order to construct the appropriate marginal ellipse when the computer package is designed to plot only joint ellipses (such as the case of Eviews). df when.95 when.90 0 0.867 0.758 0 0.860 0.750 30 0.858 0.747 40 0.856 0.746 50 0.856 0.745 00 0.855 0.743 00 0.854 0.74 5000 0.854 0.74 Tale. The correspondence etween and for various sample sizes. From this tale it can e seen that in a moderately sized sample (>0) to otain a 95% marginal confidence ellipse (ie corresponding to 0.05 in ()) using (0), the value of in (0) needs to e set to 0.5, which corresponds to an 85% joint confidence ellipse. 5. Stata Program In the Stata program we rewrite the regression equation defined in (7) as 0 0.5 y z z () So that the turning point defined in (9) ecomes (3) 7
which can e estimated using the OLS estimates ˆ and ˆ from (). The program contains 4 lines to generate a confidence ellipse. The ellipse is generated y calling upon the program ellip from Alexandersson (004). For large samples, to otain the appropriate dimensions of the marginal confidence ellipse the appropriate oundary constant is a chi square with degree of freedom. The options xla and yla are used to plot the ellipse over appropriate values. use "c:\cuic\californian.dta" generate z = -0.5*z^ regress y z z ellip z z, coefs c(chi ) yla(0 5 0 5 0 5 30 35 40 45) xla(0 3 4 5 6 7 8 9 0 ) 5. Eviews program (versions 5 and 6) Once the data have een read into Eviews, the first step is to estimate the regression specified in () as follows: Figure The regression specification dialogue window in Eviews Then to otain the 95% marginal confidence ellipse, we use Confidence Ellipse availale under the view/coefficient Tests option and specify the confidence level as 0.85. The estimated coefficients correspond to c(), the estimate of the denominator of the ratio (ie -0.5*z^) and c(), the estimate of the numerator of the ratio (ie z). Note that the scales on oth the x and y axes can e altered in the default graph y clicking on them. 8
Figure The ellipse dialogue window for the analysis of regression results in Eviews. 5.3 Gauss Program Gauss is a general purpose computer program for the computation of linear algera with a similar syntax to MATLAB, Proc IML in SAS and R. In the Gauss program listed elow we estimate () where we refer to the OLS estimates of ˆ and ˆ as g and g respectively. fstat uses the function invf to compute the critical value from the F distriution. Note to otain the 95% critical value for the appropriate confidence ellipse this is required to e set to 0.5. The program to compute the confidence ellipse is modified from Hill and Adkins (00, pages 47 & 6). Note that scale is used in the plotting routine to plot the ellipse over the appropriate values. /* Read in data and generate data for regression*/ num = 40;k=3; df=num-k; load data[num,]= c:\cuic\ellipse.txt; y = data[.,]; z = data[.,]; z = -0.5*z.^; /* Run Regression*/ con=; {nam,m,,st,vc,std,sig,cx,rsq,resid,dw} = ols(0,y,z~z); /* Otain estimates and variances and covariances */ g = [,]; g = [3,]; cov = zeros(,); cov[,] = vc[,]; cov[,] = vc[,3]; cov[,] = cov[,]; 9
cov[,] = vc[3,3]; /* Choose critical value for ellipse*/ fstat = invf(,df,.5); fn invf(df,df,alpha) = 0.95 + 0.05* minindc( as (cdffc( seqa(,.05,000),df,df)- alpha )); /* Generate ellipse */ a = inv(cov); q = a[,]*a[,] - a[,]*a[,]; l = g - sqrt(*fstat*a[,]/q); u = g + sqrt(*fstat*a[,]/q); eta = seqa(l,(u-l)/00,0); csq = (g - eta)^*( - q/a[,]^) + fstat*/a[,]; c = sqrt(as(csq)); etaa = g + (g-eta)*a[,]/a[,] + c; eta = g + (g-eta)*a[,]/a[,] - c; d = eta rev(eta); d = etaa rev(eta); /* Plot the ellipse and estimated values of the numerator and denominator of ratio*/ lirary pgraph; _paxes = ; _pdate = 0; _pmcolor=9; let xx = 0 ; let yy = 0 48; scale(xx,yy); xlael("denominator of ratio"); ylael("numerator of ratio"); xy(d,d); _psym = zeros(,7); _psym[] = g; _psym[] = g; _psym[3] = 8; _psym[4] = ; _psym[5] = 5; _psym[6] = ; _psym[7] = ; 5.4 Construction of Fieller intervals. Once the ellipse has een drawn it can e pasted into a standard drawing package such as Microsoft Visio or one can construct the ounds using a ruler on the printed version. For the figure shown elow we imported the default graph from Gauss into Microsoft Visio and added in the additional lines to otain the lower and upper ounds of the Fieller interval. Note it is necessary to have the origin (0,0) included in the graph to construct the intervals. See Hirscherg and Lye (009) for details as to the steps for construction of the interval. 0
Figure 3 Example of ellipse generated y GAUSS routine with lines added with Microsoft VISIO.
References Alexandersson, A. (004), Graphing confidence ellipses: An update of ellip for Stata 8, The Stata Journal, 4, 4-56. Durand, D., 954, Joint Confidence Regions for Multiple Regression Coefficients, Journal of the American Statistical Association, 49, 30-46. Fieller, E. C., 93, The Distriution of the Index in a Normal Bivariate Population, Biometrika, 4,48-440. Fieller, E. C., 944, A Fundamental Formula in the Statistics of Biological Assay, and Some Applications, Quarterly Journal of Pharmacy and Pharmacology, 7, 7-3. Fieller, E. C., 954, Some Prolems in Interval Estimation, Journal of the Royal Statistical Society, Series B, 6, 74-85. Guiard, V., 989, Some remarks on the estimation of the ratio of the expected values of a twodimensional normal random variale(correction of the theorem of Milliken), Biometrical Journal, 3, 68-697. Hill, C. and L. Adkins (00), Using Gauss for Econometrics, downloaded 3//008 http://pages.suddenlink.net/ladkins/pdf/gauss.pdf Hinkley, D. V., 969, On the ratio of two correlated normal random variales, Biometrika, 56, 635-639. Hirscherg, J. and J. Lye, 009, A Geometric Comparison of the Delta and Fieller Confidence Intervals, Department of Economics, University of Melourne, Working Paper. Marks, E., 98, A Note on a Geometric Interpretation of the Correlation Coefficient, Journal of Education Statistics, 7, 33-37. Marsaglia, G., 965, Ratios of normal variales and ratios of sums of uniform variales, Journal of the American Statistical Association, 60, 93-04. Scheffé, H., 959, The Analysis of Variance, John Wiley & Sons, New York, NY. Stock, J. and M. Watson, (007), Introduction to Econometrics, nd Edition, Pearson Education, Inc. USA. Von Luxurg, U. and V. Franz, 004, Confidence Sets for Ratios: A Purely Geometric Approach to Fieller s Theorem, Technical Report N0. TR-33, Max Planck Institute for Biological Cyernetics. Zere, G. O., 978, On Fieller s Theorem and the General Linear Model, The American Statistician, 3, 03-05.