搜索
人大经济论坛 附件下载

附件下载

所在主题:
文件名:  171907.pdf
资料下载链接地址: https://bbs.pinggu.org/a-171907.html
附件大小:
251.3 KB   举报本内容
<p>[Point=2]<br/>[/Point]</p><p>&nbsp;</p><p class="MsoNormal" align="center" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center; mso-pagination: widow-orphan;"><font face="Times New Roman"><b><span lang="EN-US" style="FONT-SIZE: 16pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;">Programming Advice</span></b><span lang="EN-US" style="FONT-SIZE: 16pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><p></p></span></font></p><p class="MsoNormal" align="center" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center; mso-pagination: widow-orphan;"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-font-kerning: 0pt;"><font face="Times New Roman">Mitchell A. Petersen<p></p></font></span></b></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">&nbsp;&nbsp;&nbsp; My purpose in writing this paper was to make sure researchers (myself included) understood what each of the methods for estimating standard errors was actually doing. These pages are meant to help researchers use the correct techniques. Code which is easily available is more likely to be used. Since I program in </font><a href="http://www.stata.com/"><span style="COLOR: windowtext; TEXT-DECORATION: none; text-underline: none;"><font face="Times New Roman">Stata</font></span></a><font face="Times New Roman">, most of the instructions below are for Stata. I have also included </font><a href="http://www.kellogg.northwestern.edu/faculty/petersen/htm/papers/se/se_programming.htm#_SAS_Programming_Instructions#_SAS_Programming_Instructions"><font face="Times New Roman">SAS code</font></a><font face="Times New Roman"> (contributed by Tanguy Brachet). If you know how to do this in other languages, please let me know. I am happy to post links to the instructions. With all of the instructions, the programming instructions are in bold. The variable names which the user must specify are in italics. I have also included a sample of the Stata program which I used to </font><a href="http://www.kellogg.northwestern.edu/faculty/petersen/htm/papers/se/se_programming.htm#_Simulated_Data_Sets#_Simulated_Data_Sets"><font face="Times New Roman">run the simulations</font></a><font face="Times New Roman"> (i.e. simulated the data sets and then estimated the coefficients and standard errors). <p></p></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-outline-level: 1;"><b><span lang="EN-US" style="FONT-SIZE: 14pt; FONT-FAMILY: Arial; mso-font-kerning: 16.0pt;">Stata Programming Instructions<p></p></span></b></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">The standard command for running a regression in Stata is:<p></p></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">&nbsp;&nbsp;&nbsp; regress <i style="mso-bidi-font-style: normal;">dependent_variable independent&shy;_variables</i>, options<p></p></font></span></b></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 36pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-outline-level: 2;"><place wst="on"><city wst="on"><b><i><span lang="EN-US" style="FONT-SIZE: 14pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt;">Rogers</span></i></b></city></place><b><i><span lang="EN-US" style="FONT-SIZE: 14pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt;"> or Clustered Standard Error<p></p></span></i></b></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">To obtain Rogers/Clustered standard errors (and OLS coefficients), use the command: <p></p></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">&nbsp;&nbsp;&nbsp; regress <i style="mso-bidi-font-style: normal;">dependent_variable independent_variables</i>, robust cluster(<i style="mso-bidi-font-style: normal;">cluster_variable</i>)<p></p></font></span></b></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">This produces White standard errors which are robust to within cluster correlation (<place wst="on"><city wst="on">Rogers</city></place> or clustered standard errors). If you wanted to cluster by year, then the<i>
</i>cluster variable would be the year variable. If you wanted to cluster by industry and year, you would need to create a variable which had a unique value for each industry-year pair. For most estimation commands such as logits and probits, the previous form of the command will also work. For example, to run a logit with Rogers/Clustered standard errors you would use the command: <p></p></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">&nbsp;&nbsp;&nbsp; logit <i style="mso-bidi-font-style: normal;">dependent_variable independent_variables</i>, robust cluster(<i style="mso-bidi-font-style: normal;">cluster_variable</i>)<p></p></font></span></b></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 36pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-outline-level: 2;"><b><i><span lang="EN-US" style="FONT-SIZE: 14pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt;">Fama-MacBeth Standard Errors<p></p></span></i></b></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">Stata does not contain a routine for estimating the coefficients and standard errors by Fama-MacBeth (that I know of), but I have written two routines (ado files) which you can download. The ado file </font><a href="http://www.kellogg.northwestern.edu/faculty/petersen/htm/papers/se/fm.ado"><font face="Times New Roman">fm.ado</font></a><font face="Times New Roman"> runs a cross-sectional regression for each year in the data set. <p></p></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">The form of the command is: <p></p></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">&nbsp;&nbsp;&nbsp; <b style="mso-bidi-font-weight: normal;">fm <i style="mso-bidi-font-style: normal;">dependent_variable independent_variables</i><p></p></b></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">Prior to running the fm program, you need to use the tsset command. This tells Stata the name of the firm identifier and the time variable. The form of these command is:<p></p></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><font face="Times New Roman"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-bidi-font-size: 13.5pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;">&nbsp;&nbsp;&nbsp; tsset <i style="mso-bidi-font-style: normal;">firm_identifier time_identifier</i></span></b><b style="mso-bidi-font-weight: normal;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><p></p></span></b></font></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">The program will accept the Stata in and if commands, if you want to do the regression for only certain observations. The file </font><a href="http://www.kellogg.northwestern.edu/faculty/petersen/htm/papers/se/fmw.ado"><font face="Times New Roman">fmw.ado</font></a><font face="Times New Roman"> does the weighted average version of Fama-MacBeth, where each year’s coefficient is weighted by the number of observations in that year. </font><a href="mailto:jcaskey@umich.edu?subject=Fama-MacBeth"><font face="Times New Roman">Justin Caskey</font></a><font face="Times New Roman">, who showed me how to use the tsset command in the FM program, has also modified the program. </font><a href="http://webuser.bus.umich.edu/nhafzall/fmJ.ado"><font face="Times New Roman">His version</font></a><font face="Times New Roman"> reports the number of positive or negative coefficients and the number which are significant (and positive or negative). <p></p></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-outline-level: 2;"><b><i><span lang="EN-US" style="FONT-SIZE: 14pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt;">Newey West for Panel Data Sets<p></p></span></i></b></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">The Stata command newey will estimate the coefficients of a regression using OLS and generate Newey-West standard errors. If you want to use this in a panel data set (so that only observations within a cluster may be correlated), you need to use the tsset command. <p></p></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><font face="Times New Roman"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-bidi-font-size: 13.5pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;">&nbsp;&nbsp;&nbsp; newey <i style="mso-bidi-font-style: normal;">dependent_variable independent_variables</i>, lag(<i style="mso-bidi-font-style: normal;">lag_length</i>) force</span></b><b style="mso-bidi-font-weight: normal;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><p></p></span></b></font></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">Where <i>firm_identifier</i> is the variable which denotes each firm (e.g. cusip, permn, or gvkey) and <i>time_identifier</i> is the variable that identifies the time dimension, such as year. This specification will allow for observations on the same firm in different years to be correlated (i.e. a firm effect). If you want to allow for observations on different firms but in the same year to be correlated you need to reverse the firm and time identifiers. If you are clustering on some other dimension besides firm (e.g. industry or country), you would use that variable instead. You can specify any lag length up to T-1, where T is the number of years per firm.<p></p></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 36pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-outline-level: 2;"><b><i><span lang="EN-US" style="FONT-SIZE: 14pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt;">Fixed Effects<p></p></span></i></b></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">Stata can automatically include a set of dummy variable for each value of one specified variable. <p></p></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">The form of the command is:<p></p></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><font face="Times New Roman"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-bidi-font-size: 13.5pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;">&nbsp;&nbsp;&nbsp; areg <i style="mso-bidi-font-style: normal;">dependent_variable independent_variables</i>, absorb(<i style="mso-bidi-font-style: normal;">identifier_variable</i>) </span></b><b style="mso-bidi-font-weight: normal;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><p></p></span></b></font></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">Where <i>identifier_variable</i> is a firm identifier (e.g. cusip, permn, or gvkey) if you want firm dummies or a time identifier (e.g. year) if you want year dummies. If you want to include both firm and time dummies, only one set can be included with the absorb option. The other must be included manually (e.g. by manually including a full set of time dummies among the independent variables, and then using the absorb option for the firm dummies). <p></p></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">To create a full set of dummy variables from an indexed variable such as year you can use the following command:<p></p></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><font face="Times New Roman"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-bidi-font-size: 13.5pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;">&nbsp;&nbsp;&nbsp; tabulate <i style="mso-bidi-font-style: normal;">index_variable</i>, gen(<i style="mso-bidi-font-style: normal;">dummy_variable</i>)</span></b><b style="mso-bidi-font-weight: normal;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><p></p></span></b></font></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">This will create a set of dummy variables (e.g. dummy_variable1, dummy_variable2, etc), which are equal to one if the <i>index_variable</i> takes on its first value and zero otherwise (in the case of dummy_variable1). <p></p></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">A more elegant way to do this is to use the xi command (as recommended by </font><a href="http://www.yorku.ca/dnandy"><font face="Times New Roman">Prof Nandy</font></a><font face="Times New Roman">). This allows you to include a set of dummy variables for any categorical variable (e.g. year or firm), including multiple categorical values. To include both year and firm dummies, the command is: <p></p></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><font face="Times New Roman"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-bidi-font-size: 13.5pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;">&nbsp;&nbsp;&nbsp; xi: areg <i style="mso-bidi-font-style: normal;">dependent_variable independent_variables</i> i.<i style="mso-bidi-font-style: normal;">year</i> absorb(<i style="mso-bidi-font-style: normal;">firm_identifier</i>) </span></b><b style="mso-bidi-font-weight: normal;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><p></p></span></b></font></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">where year is the categorical variable for year and firm_identifier is the categorical variable for firm. The coefficients on T-1 of the year variables will be reported, the coefficients on the firm dummy variables will not. To see the coefficients on both sets of<span style="mso-spacerun: yes;">&nbsp; </span>dummy variables you would use the command: <p></p></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><font face="Times New Roman"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-bidi-font-size: 13.5pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;">&nbsp;&nbsp;&nbsp; xi: reg <i style="mso-bidi-font-style: normal;">dependent_variable independent_variables</i> i.<i style="mso-bidi-font-style: normal;">year </i>i.<i style="mso-bidi-font-style: normal;">firm_identifier</i></span></b><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><p></p></span></font></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><p><font face="Times New Roman">&nbsp;</font></p></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-outline-level: 2;"><b><i><span lang="EN-US" style="FONT-SIZE: 14pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt;">Bootstrapped Standard Errors <p></p></span></i></b></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">The Stata command bootstrap will allow you to estimate the standard errors using the bootstrap method. This will run the regression multiple times and use the variability in the slope coefficients as an estimate of their standard deviation (intuitively like I did with my simulations. <p></p></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">The form of these command is:<p></p></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><font face="Times New Roman"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-bidi-font-size: 13.5pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;">&nbsp;&nbsp;&nbsp; bootstrap “regress<span style="mso-spacerun: yes;">&nbsp; </span><i style="mso-bidi-font-style: normal;">dependent_variable independent_variables</i>” _b, reps(<i style="mso-bidi-font-style: normal;">number_of_repetitions</i>) </span></b><b style="mso-bidi-font-weight: normal;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><p></p></span></b></font></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><font face="Times New Roman"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;">Where </span><i style="mso-bidi-font-style: normal;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-bidi-font-size: 13.5pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;">number_of_repetitions</span></i><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"> samples will be drawn with replacement from the original sample. Each time the regression will be run and the slope coefficients will be saved, since _b is specified. Both the average slope and its standard deviation will be reported. As specified, the bootstrapped samples will be drawn a single observation at a time. If the observations within a cluster (year or firm) are correlated, then these bootstrapped standard errors will be biased. To account for the correlation within cluster it is necessary to draw clusters with replacement oppose observations with replacement. To do this in Stata, you need to add the cluster option. In this case, the command is: <p></p></span></font></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><font face="Times New Roman"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-bidi-font-size: 13.5pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;">&nbsp;&nbsp;&nbsp; bootstrap “regress<span style="mso-spacerun: yes;">&nbsp; </span><i style="mso-bidi-font-style: normal;">dependent_variable independent_variables</i>” _b, reps(<i style="mso-bidi-font-style: normal;">number_of_repetitions</i>) </span></b><b style="mso-bidi-font-weight: normal;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;">cluster(<i style="mso-bidi-font-style: normal;">cluster_variable</i>)</span></b><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><p></p></span></font></p><div class="MsoNormal" align="center" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman"><hr align="center" width="100%" size="2"/></font></span></div><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-outline-level: 1;"><a name="_SAS_Programming_Instructions"></a><b><span lang="EN-US" style="FONT-SIZE: 16pt; FONT-FAMILY: Arial; mso-font-kerning: 16.0pt;">SAS Programming Instructions<p></p></span></b></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">Although I did not do the empirical work in SAS, </font><a href="mailto:tbrachet@econ.Berkeley.EDU?subject=Fama-MacBeth"><font face="Times New Roman">Tanguy Brachet</font></a><font face="Times New Roman"> was kind enough to explain how to do some of the estimation in SAS. I am responsible for errors. A brief description follows. <p></p></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 36pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-outline-level: 2;"><place wst="on"><city wst="on"><b><i><span lang="EN-US" style="FONT-SIZE: 14pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt;">Rogers</span></i></b></city></place><b><i><span lang="EN-US" style="FONT-SIZE: 14pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt;"> or Clustered Standard Errors<p></p></span></i></b></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">The standard command for running an OLS regression in SAS and getting the Clustered/Rogers standard errors is:<br/><br/>&nbsp;</font><b style="mso-bidi-font-weight: normal;"><font face="Times New Roman">&nbsp;&nbsp; proc surveyreg data=<i style="mso-bidi-font-style: normal;">mydata</i>;<br/>&nbsp;&nbsp;&nbsp;<span style="mso-tab-count: 1;">&nbsp;&nbsp;&nbsp; </span>cluster <i style="mso-bidi-font-style: normal;">cluster_variable</i>;<br/>&nbsp;&nbsp;&nbsp; <span style="mso-tab-count: 1;">&nbsp; </span>model <i style="mso-bidi-font-style: normal;">dependent variable</i> = <i style="mso-bidi-font-style: normal;">independent variables</i>;<p></p></font></b></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">This produces White standard errors which are robust to within cluster correlation (<place wst="on"><city wst="on">Rogers</city></place> or clustered standard errors), when cluster_variable is the variable by which you want to cluster. If you clustered by firm it could be cusip or gvkey. If you clustered by time it could be year. <p></p></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 36pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-outline-level: 2;"><b><i><span lang="EN-US" style="FONT-SIZE: 14pt; FONT-FAMILY: Arial; mso-font-kerning: 0pt;">Fixed Effects<p></p></span></i></b></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">If you want to include dummy variables for one dimension (time) and cluster by another dimension, you need to create the dummy variables. A simple way (there are more elegant ways) is as follows.<p></p></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-bidi-font-size: 13.5pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">&nbsp; &nbsp;</font></span></b><b style="mso-bidi-font-weight: normal;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">data new; <br/>&nbsp;&nbsp;&nbsp;<span style="mso-tab-count: 1;">&nbsp;&nbsp;&nbsp; </span>set old; <br/>&nbsp;&nbsp;&nbsp; <span style="mso-tab-count: 1;">&nbsp; </span>year1 = (year=1991); <br/>&nbsp;&nbsp;&nbsp; <span style="mso-tab-count: 1;">&nbsp; </span>year2 = (year=1992); <br/>&nbsp;&nbsp;&nbsp; <span style="mso-tab-count: 1;">&nbsp; </span>year3 = (year=1993); <br/>&nbsp;&nbsp;&nbsp; <span style="mso-tab-count: 1;">&nbsp; </span>year4 = (year=1994); <br/>&nbsp;&nbsp;&nbsp; <span style="mso-tab-count: 1;">&nbsp; </span>year5 = (year=1995); <p></p></font></span></b></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">As SAS is not my traditional language, this code is provided just as information. I have used both the SAS and Stata code to verify that the results produced by both sets of instructions (SAS and Stata) are the same based on a </font><a href="http://www.kellogg.northwestern.edu/faculty/petersen/htm/papers/se/test_data.htm"><font face="Times New Roman">test data set</font></a><font face="Times New Roman">. <p></p></font></span></p><div class="MsoNormal" align="center" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: center; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman"><hr align="center" width="100%" size="2"/></font></span></div><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-outline-level: 1;"><a name="_Simulated_Data_Sets"></a><b><span lang="EN-US" style="FONT-SIZE: 16pt; FONT-FAMILY: Arial; mso-font-kerning: 16.0pt;">Simulated Data Sets<p></p></span></b></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">&nbsp;&nbsp;&nbsp; Many of the results in the paper are based on simulating data sets with a specified dependence (firm and/or time effect). For those who are interested in seeing how this was done or trying different data structures, I have posted a stripped down version of the </font><a href="http://www.kellogg.northwestern.edu/faculty/petersen/htm/se_simulation.do"><span style="COLOR: windowtext; TEXT-DECORATION: none; text-underline: none;"><font face="Times New Roman">simulation program.</font></span></a><font face="Times New Roman"> This program simulates a data set with a firm effect and then estimates the coefficients using OLS and Fama-MacBeth. The standard errors are estimated by OLS, Rogers/Clustering, and Fama-MacBeth. The results are saved for each iteration, and the means and standard deviations are calculated and displaced. To run the program, </font><a href="http://www.kellogg.northwestern.edu/faculty/petersen/htm/papers/se/simulation.do"><font face="Times New Roman">simulation.do</font></a><font face="Times New Roman">, you need to type <p></p></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 7.8pt 0cm; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-para-margin-top: .5gd; mso-para-margin-right: 0cm; mso-para-margin-bottom: .5gd; mso-para-margin-left: 0cm;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">&nbsp;&nbsp;&nbsp;<b style="mso-bidi-font-weight: normal;"> do simulation<i style="mso-bidi-font-style: normal;"> firm_effect_x firm_effect_r number_of years </i><p></p></b></font></span></p><p class="MsoNormal" align="left" style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan;"><span lang="EN-US" style="FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-font-kerning: 0pt;"><font face="Times New Roman">where firm_effect_x is the percent of the independent variable’s variance which is due to the firm effect [i.e. rho(x)], firm_effect_r is the percent of the residual’s variance which is due to the firm effect [i.e. rho(r)], and number_of_years is the number of time periods per firm in the data set. The data set will have 5,000 observations (although this can be changed), so the number of firms is 5,000/number_of_years. Other parameters can be changed by editing the program. This example is just meant to provide intuition of how I did the simulations. If you have questions about this page, you are welcome to e-mail me. I can not promise an immediate response, but I will try to get back to you. I unfortunately, can’t help you debug your stata (or non-stata) programs. However, by posting these instructions I hope to make it easier to use the methods discussed in my paper. <p></p></font></span></p><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt;"><span lang="EN-US"><p><font face="Times New Roman">&nbsp;</font></p></span></p><p>&nbsp;</p><br/>


    熟悉论坛请点击新手指南
下载说明
1、论坛支持迅雷和网际快车等p2p多线程软件下载,请在上面选择下载通道单击右健下载即可。
2、论坛会定期自动批量更新下载地址,所以请不要浪费时间盗链论坛资源,盗链地址会很快失效。
3、本站为非盈利性质的学术交流网站,鼓励和保护原创作品,拒绝未经版权人许可的上传行为。本站如接到版权人发出的合格侵权通知,将积极的采取必要措施;同时,本站也将在技术手段和能力范围内,履行版权保护的注意义务。
(如有侵权,欢迎举报)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

GMT+8, 2025-12-29 15:06