Delta Method Standard Error Stata
Contents |
on statistics Stata Journal Stata Press Stat/Transfer Gift Shop Purchase Order Stata Request a quote Purchasing FAQs Bookstore Stata Press books Books on Stata Books on statistics standard error regression stata Stat/Transfer Stata Journal Gift Shop Training NetCourses Classroom and web On-site Video tutorials standard error stata output Third-party courses Support Updates Documentation Installation Guide FAQs Register Stata Technical services Policy Contact Publications Bookstore Stata Journal Stata
Standard Error Stata Command
News Conferences and meetings Stata Conference Upcoming meetings Proceedings Email alerts Statalist The Stata Blog Web resources Author Support Program Installation Qualification Tool Disciplines Company StataCorp Contact us Hours of operation Announcements
Robust Standard Error Stata
Customer service Register Stata online Change registration Change address Subscribe to Stata News Subscribe to email alerts International resellers Careers Our sites Statalist The Stata Blog Stata Press Stata Journal Advanced search Site index Purchase Products Training Support Company >> Home >> Resources & support >> FAQs >> Compute standard errors with margins Based on a Statalist post by Jeff Pitblado: http://www.statalist.org/forums/forum/general-stata-discussion/general/98078-delta-method-standard-errors-for-average-marginal-effects-using-margins-command. delta method standard error of variance How are average marginal effects and their standard errors computed by margins using the delta method? Title Compute standard errors with margins Author Jeff Pitblado, StataCorp In the following, I use the nofvlabel option so that the output aligns with the expressions I use. nofvlabel is a display option that is common to margins and estimation commands. This option was introduced in Stata 13, where we now show the value labels for factor variables by default. Introduction Here is an example using logit: . webuse margex (Artificial data for margins) . logit outcome i.treatment distance, nofvlabel Iteration 0: log likelihood = -1366.0718 Iteration 1: log likelihood = -1257.5623 Iteration 2: log likelihood = -1244.2136 Iteration 3: log likelihood = -1242.8796 Iteration 4: log likelihood = -1242.8245 Iteration 5: log likelihood = -1242.8245 Logistic regression Number of obs = 3000 LR chi2(2) = 246.49 Prob > chi2 = 0.0000 Log likelihood = -1242.8245 Pseudo R2 = 0.0902 ------------------------------------------------------------------------------ outcome | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- 1.treatment | 1.42776 .113082 12.63 0.000 1.206124 1.649397 distance | -.0047747 .0011051 -4.32 0.000 -.0069406 -.0026088 _cons | -2.337762 .0962406 -24.29
non-linear transformation * Stata do file * The Delta method can be used to estimate the standard errors after a regression estimation. * Imagine you have some parameter G = (3*b0-b1)*b2^2 = 3*b0*b2^2-b1*b2^2 * Where y = bo + b1*x1 + b2*x2
Standard Deviation Stata
+ u * The delta method can be used to estimate the standard errors confidence interval stata of G. * The delta method states that var_hat(G)=(dG/db) var(b) (dG/db) * dG/db is a gradient vector: * dG/db = [dG/db0, t test stata dG/db1, dG/db2] * dG/db = [b2^2, -b2^2, 2*(b0-b1)*b2] * var_hat(G) = (3*b2^2)^2 * se(b0)^-2 + (-b2^2)^2 * se(b1)^-2 + (2*(b0-b1)*b2)^2 * se(b2)^-2 [There is an error in the code because I failed to include a http://www.stata.com/support/faqs/statistics/compute-standard-errors-with-margins/ covariance term for the coefficients. Please see the more recent update on the method.] clear set obs 1000 gen x1 = rnormal() gen x2 = rnormal() * 4 global b0 = 1 global b1 = 1.5 global b2 = .3 local true_G = (3*${b0}-${b1})*${b2}^2 di `true_G' gen y = ${b0} + ${b1}*x1 + ${b2}*x2 + rnormal()*8 reg y x1 x2 * G = (3*b0-b1)*b2^2 = 3*b0*b2^2 - b1*b2^2 local Ghat = http://www.econometricsbysimulation.com/2012/12/the-delta-method-to-estimate-standard.html (3*_b[_cons]-_b[x1])*_b[x2]^2 di "Ghat = `Ghat' is our estimate (true = `true_G')" * Let's see if we can't use the delta method to derive a standard error. local var_hatG = (3*_b[x2]^2)^2 * _se[_cons]^2 + (-_b[x2]^2)^2 * _se[x1]^2 + (2*(_b[_cons]-_b[x1])*_b[x2])^2 * _se[x2]^2 di "Standard error estimate is " `var_hatG'^.5 * Alternatively, let us attempt to bootstrap our standard errors. cap program drop deltaOLS program define deltaOLS, rclass reg y x1 x2 return scalar Ghat = (3*_b[_cons]-_b[x1])*_b[x2]^2 end bs Ghat=r(Ghat), rep(500): deltaOLS * The bootstrap standard errors are similar to that of the delta method's standard errors. cap program drop deltaMonteCarlo program define deltaMonteCarlo, rclass clear set obs 1000 gen x1 = rnormal() gen x2 = rnormal() * 4 gen y = ${b0} + ${b1}*x1 + ${b2}*x2 + rnormal()*8 reg y x1 x2 return scalar Ghat = (3*_b[_cons]-_b[x1])*_b[x2]^2 end simulate Ghat=r(Ghat), reps(500): deltaMonteCarlo sum * We can see that our estimates of the standard error via the Delta method and bootstap is quite close to the monte carlo estimates on observed standard errors from 500 replications. Posted by Francis Smart at 12/07/2012 Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest 1 comment: mabubraiMarch 23, 2016 at 7:03 PMi think you missed number 3 i
Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more http://stats.stackexchange.com/questions/60893/standard-error-of-the-quotient-of-two-estimates-wald-estimators-using-the-delt about Stack Overflow the company Business Learn more about hiring developers or posting ads http://www.ats.ucla.edu/stat/r/faq/deltamethod.htm with us Cross Validated Questions Tags Users Badges Unanswered Ask Question _ Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best standard error answers are voted up and rise to the top Standard error of the quotient of two estimates (Wald estimators) using the delta method up vote 4 down vote favorite 1 I have two coefficients' estimates from a regression, each of which has an estimated standard error. I would like to know the quotient of these two estimates -- that is, divide one of the estimates by the other. What would standard error stata be the corresponding standard error? Would this be a candidate for the Delta Method? If so, how should the formula be applied? If this is not something that can be computed in a straightforward manner, is there a way to do this in Stata? In particular, I am interested in the Wald Estimator. In the Delta Method, there is a covariance term typically. Is it zero or non-zero in this case; that is, when can we assume that the two estimates are independent? stata standard-error delta-method nonlinear share|improve this question edited Jun 9 '13 at 13:39 Nick Cox 28.2k35684 asked Jun 4 '13 at 21:50 user1690130 260520 This might be of some use –Glen_b♦ Jun 4 '13 at 23:48 add a comment| 2 Answers 2 active oldest votes up vote 3 down vote Here's an example in Stata of how to create the ratio and test a hypothesis using nlcom: . webuse regress . regress y x1 x2 x3 Source | SS df MS Number of obs = 148 -------------+------------------------------ F( 3, 144) = 96.12 Model | 3259.3561 3 1086.45203 Prob > F = 0.0000 Residual | 1627.56282 144 11.3025196 R-squared = 0.6670 -------------+------------------------------ Adj R-squared = 0.6600 Total | 4886.91892 147 33.2443464 Root MSE = 3.3619 ---------------------------------------------------------
transformed regression parameters in R using the delta method? The purpose of this page is to introduce estimation of standard errors using the delta method. Examples include manual calculation of standard errors via the delta method and then confirmation using the function deltamethod so that the reader may understand the calculations and know how to use deltamethod. This page uses the following packages Make sure that you can load them before trying to run the examples on this page. We will need the msm package to use the deltamethodfunction. If you do not have a package installed, run: install.packages("packagename"), or if you see the version is out of date, run: update.packages(). library(msm) Version info: Code for this page was tested in R version 3.1.1 (2014-07-10)
On: 2014-08-01
With: pequod 0.0-3; msm 1.4; phia 0.1-5; effects 3.0-0; colorspace 1.2-4; RColorBrewer 1.0-5; xtable 1.7-3; car 2.0-20; foreign 0.8-61; Hmisc 3.14-4; Formula 1.1-2; survival 2.37-7; lattice 0.20-29; mgcv 1.8-1; nlme 3.1-117; png 0.1-7; gridExtra 0.9.1; reshape2 1.4; ggplot2 1.0.0; vcd 1.3-1; rjson 0.2.14; RSQLite 0.11.4; DBI 0.2-7; knitr 1.6 Background to delta method Often in addition to reporting parameters fit by a model, we need to report some transformation of these parameters. The transformation can generate the point estimates of our desired values, but the standard errors of these point estimates are not so easily calculated. They can, however, be well approximated using the delta method. The delta method approximates the standard errors of transformations of random variable using a first-order Taylor approximation. Regression coefficients are themselves random variables, so we can use the delta method to approximate the standard errors of their transformations. Although the delta method is often appropriate to use with large samples, this page is by no means an endorsement of the use of the delta method over other methods to estimate standard errors, such as bootstrapping. Essentially, the delta method involves calculating the variance of the Taylor series approximation of a function. We, thus, first get the Taylor series approximation of the function using the first two terms of the Taylor expansion of the transformation function about the mean of of the random variable. Let \(G\) be the transformation function and \(U\) be the mean vector of random variables \(X=(x1,x2,...)\). The first two terms of the Taylor expansion are