----------------------------------------------------------------------------------- log: C:\Documents and Settings\salon\Escritorio\clase17mar.log log type: text opened on: 18 Mar 2005, 16:03:43 . set memory 5m . use http://www.stata-press.com/data/r8/nlswork, clear (National Longitudinal Survey. Young Women 14-26 years of age in 1968) . desc Contains data from http://www.stata-press.com/data/r8/nlswork.dta obs: 28,534 National Longitudinal Survey. Young Women 14-26 years of age in 1968 vars: 21 9 Jun 2002 17:36 size: 1,055,758 (49.7% of memory free) ------------------------------------------------------------------------------- storage display value variable name type format label variable label ------------------------------------------------------------------------------- idcode int %8.0g NLS id year byte %8.0g interview year birth_yr byte %8.0g birth year age byte %8.0g age in current year race byte %8.0g 1=white, 2=black, 3=other msp byte %8.0g 1 if married, spouse present nev_mar byte %8.0g 1 if never yet married grade byte %8.0g current grade completed collgrad byte %8.0g 1 if college graduate not_smsa byte %8.0g 1 if not SMSA c_city byte %8.0g 1 if central city south byte %8.0g 1 if south ind_code byte %8.0g industry of employment occ_code byte %8.0g occupation union byte %8.0g 1 if union wks_ue byte %8.0g weeks unemployed last year ttl_exp float %9.0g total work experience tenure float %9.0g job tenure, in years hours int %8.0g usual hours worked wks_work int %8.0g weeks worked last year ln_wage float %9.0g ln(wage/GNP deflator) ------------------------------------------------------------------------------- Sorted by: idcode year . xtreg ln_w grade age* ttl_exp, fe i(idcode) Fixed-effects (within) regression Number of obs = 28508 Group variable (i): idcode Number of groups = 4708 R-sq: within = 0.1373 Obs per group: min = 1 between = 0.2575 avg = 6.1 overall = 0.1799 max = 15 F(2,23798) = 1893.96 corr(u_i, Xb) = 0.1470 Prob > F = 0.0000 ------------------------------------------------------------------------------ ln_wage | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- grade | (dropped) age | -.0055047 .0008363 -6.58 0.000 -.0071439 -.0038656 ttl_exp | .0384345 .0012416 30.96 0.000 .0360009 .040868 _cons | 1.596039 .0176186 90.59 0.000 1.561505 1.630572 -------------+---------------------------------------------------------------- sigma_u | .37662974 sigma_e | .29756814 rho | .6156769 (fraction of variance due to u_i) ------------------------------------------------------------------------------ F test that all u_i=0: F(4707, 23798) = 5.84 Prob > F = 0.0000 . summ grade Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- grade | 28532 12.53259 2.323905 0 18 . xtreg ln_w age* ttl_exp, fe i(idcode) Fixed-effects (within) regression Number of obs = 28510 Group variable (i): idcode Number of groups = 4710 R-sq: within = 0.1373 Obs per group: min = 1 between = 0.2568 avg = 6.1 overall = 0.1799 max = 15 F(2,23798) = 1893.96 corr(u_i, Xb) = 0.1469 Prob > F = 0.0000 ------------------------------------------------------------------------------ ln_wage | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- age | -.0055047 .0008363 -6.58 0.000 -.0071439 -.0038656 ttl_exp | .0384345 .0012416 30.96 0.000 .0360009 .040868 _cons | 1.596017 .0176185 90.59 0.000 1.561484 1.630551 -------------+---------------------------------------------------------------- sigma_u | .37663552 sigma_e | .29756814 rho | .61568416 (fraction of variance due to u_i) ------------------------------------------------------------------------------ F test that all u_i=0: F(4709, 23798) = 7.76 Prob > F = 0.0000 . xtdata ln_w age ttl_exp ratio() required r(198); . xtdata ln_w age ttl_exp, fe i(idcode) clear . summ Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- idcode | 28510 2601.091 1487.491 1 5159 age | 28510 29.04511 5.16945 14.79511 43.79511 ttl_exp | 28510 6.213481 3.482006 -9.644506 20.37908 ln_wage | 28510 1.674944 .2927111 -.4076857 4.783706 . do "C:\DOCUME~1\salon\CONFIG~1\Temp\STD000000.tmp" . use http://www.stata-press.com/data/r8/nlswork, clear (National Longitudinal Survey. Young Women 14-26 years of age in 1968) . end of do-file . summ ln_w age ttl_exp Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- ln_wage | 28534 1.674907 .4780935 0 5.263916 age | 28510 29.04511 6.700584 14 46 ttl_exp | 28534 6.215316 4.652117 0 28.88461 . xtdata ln_w age ttl_exp, fe i(idcode) clear . reg ln_w age ttl_exp Source | SS df MS Number of obs = 28510 -------------+------------------------------ F( 2, 28507) = 2268.73 Model | 335.408246 2 167.704123 Prob > F = 0.0000 Residual | 2107.23668 28507 .073919973 R-squared = 0.1373 -------------+------------------------------ Adj R-squared = 0.1373 Total | 2442.64492 28509 .085679783 Root MSE = .27188 ------------------------------------------------------------------------------ ln_wage | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- age | -.0055047 .0007641 -7.20 0.000 -.0070024 -.0040071 ttl_exp | .0384345 .0011344 33.88 0.000 .036211 .0406579 _cons | 1.596017 .0160976 99.15 0.000 1.564465 1.62757 ------------------------------------------------------------------------------ . reg ln_w age ttl_exp, robust Regression with robust standard errors Number of obs = 28510 F( 2, 28507) = 1892.72 Prob > F = 0.0000 R-squared = 0.1373 Root MSE = .27188 ------------------------------------------------------------------------------ | Robust ln_wage | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- age | -.0055047 .0008703 -6.33 0.000 -.0072106 -.0037989 ttl_exp | .0384345 .001232 31.20 0.000 .0360197 .0408492 _cons | 1.596017 .0185572 86.01 0.000 1.559645 1.63239 ------------------------------------------------------------------------------ . help xtreg . do "C:\DOCUME~1\salon\CONFIG~1\Temp\STD000000.tmp" . * use http://www.stata-press.com/data/r8/abdata, clear . end of do-file . do "C:\DOCUME~1\salon\CONFIG~1\Temp\STD000000.tmp" . use http://www.stata-press.com/data/r8/abdata, clear . end of do-file . desc Contains data from http://www.stata-press.com/data/r8/abdata.dta obs: 1,031 vars: 30 3 Sep 2002 12:25 size: 105,162 (98.0% of memory free) ------------------------------------------------------------------------------- storage display value variable name type format label variable label ------------------------------------------------------------------------------- c1 str9 %9s ind float %9.0g year float %9.0g emp float %9.0g wage float %9.0g cap float %9.0g indoutpt float %9.0g n float %9.0g w float %9.0g k float %9.0g ys float %9.0g rec float %9.0g yearm1 float %9.0g id float %9.0g nL1 float %9.0g nL2 float %9.0g wL1 float %9.0g kL1 float %9.0g kL2 float %9.0g ysL1 float %9.0g ysL2 float %9.0g yr1976 byte %8.0g year== 1976.0000 yr1977 byte %8.0g year== 1977.0000 yr1978 byte %8.0g year== 1978.0000 yr1979 byte %8.0g year== 1979.0000 yr1980 byte %8.0g year== 1980.0000 yr1981 byte %8.0g year== 1981.0000 yr1982 byte %8.0g year== 1982.0000 yr1983 byte %8.0g year== 1983.0000 yr1984 byte %8.0g year== 1984.0000 ------------------------------------------------------------------------------- Sorted by: id year . xtsum n Variable | Mean Std. Dev. Min Max | Observations -----------------+--------------------------------------------+---------------- n overall | 1.056002 1.341506 -2.263364 4.687321 | N = 1031 between | 1.33915 -2.043388 4.62618 | n = 140 within | .1945829 .242462 2.148389 | T-bar = 7.36429 . iis id . tis year . xtsum n k Variable | Mean Std. Dev. Min Max | Observations -----------------+--------------------------------------------+---------------- n overall | 1.056002 1.341506 -2.263364 4.687321 | N = 1031 between | 1.33915 -2.043388 4.62618 | n = 140 within | .1945829 .242462 2.148389 | T-bar = 7.36429 | | k overall | -.4415775 1.514132 -4.431217 3.852441 | N = 1031 between | 1.509255 -3.707425 3.625241 | n = 140 within | .2159628 -1.201903 .7753638 | T-bar = 7.36429 . xttab n Overall Between Within n | Freq. Percent Freq. Percent Percent ----------+----------------------------------------------------- -2.263364315032959 | 1 0.10 1 0.71 12.50 -2.103734254837036 | 1 0.10 1 0.71 12.50 -2.095570802688599 | 1 0.10 1 0.71 12.50 -2.079441547393799 | 1 0.10 1 0.71 12.50 -2.071473360061646 | 1 0.10 1 0.71 12.50 -2.032557964324951 | 3 0.29 3 2.14 13.04 -2.009915351867676 | 1 0.10 1 0.71 12.50 -2.002480506896973 | 1 0.10 1 0.71 12.50 -1.95192813873291 | 1 0.10 1 0.71 12.50 -1.937942028045654 | 1 0.10 1 0.71 12.50 -1.883874773979187 | 1 0.10 1 0.71 14.29 -1.870802640914917 | 1 0.10 1 0.71 14.29 -1.838851094245911 | 1 0.10 1 0.71 12.50 -1.820158958435059 | 1 0.10 1 0.71 14.29 -1.725971698760986 | 1 0.10 1 0.71 14.29 -1.676646590232849 | 1 0.10 1 0.71 14.29 -1.487220287322998 | 1 0.10 1 0.71 11.11 -1.482805252075195 | 1 0.10 1 0.71 14.29 (...) 4.50969409942627 | 1 0.10 1 0.71 14.29 4.587606906890869 | 1 0.10 1 0.71 14.29 4.597127914428711 | 1 0.10 1 0.71 14.29 4.597158432006836 | 1 0.10 1 0.71 14.29 4.609311580657959 | 1 0.10 1 0.71 14.29 4.615516662597656 | 1 0.10 1 0.71 14.29 4.635980606079102 | 1 0.10 1 0.71 14.29 4.668755054473877 | 1 0.10 1 0.71 14.29 4.687321186065674 | 1 0.10 1 0.71 14.29 ----------+----------------------------------------------------- Total | 1031 100.00 1022 730.00 13.69 (n = 140) . help xtgls . . xtgls n w k ys, i(id) t(year) Cross-sectional time-series FGLS regression Coefficients: generalized least squares Panels: homoskedastic Correlation: no autocorrelation Estimated covariances = 1 Number of obs = 1031 Estimated autocorrelations = 0 Number of groups = 140 Estimated coefficients = 4 Obs per group: min = 7 avg = 7.364286 max = 9 Wald chi2(3) = 5240.68 Log likelihood = -834.5829 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ n | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- w | -.3669498 .0645452 -5.69 0.000 -.4934561 -.2404435 k | .8090177 .0112307 72.04 0.000 .7870059 .8310296 ys | .4791144 .1806718 2.65 0.008 .1250042 .8332246 _cons | .3444255 .8588811 0.40 0.688 -1.33895 2.027801 ------------------------------------------------------------------------------ . xtreg n w k ys, i(id) t(year) option t() not allowed r(198); . xi: xtreg n w k ys i.year, i(id) i.year _Iyear_1976-1984 (naturally coded; _Iyear_1976 omitted) Random-effects GLS regression Number of obs = 1031 Group variable (i): id Number of groups = 140 R-sq: within = 0.6280 Obs per group: min = 7 between = 0.8474 avg = 7.4 overall = 0.8355 max = 9 Random effects u_i ~ Gaussian Wald chi2(11) = 2137.45 corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ n | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- w | -.299485 .0544527 -5.50 0.000 -.4062103 -.1927598 k | .6458372 .0178711 36.14 0.000 .6108105 .6808638 ys | .1783213 .0833213 2.14 0.032 .0150145 .3416281 _Iyear_1977 | -.0364859 .0192939 -1.89 0.059 -.0743011 .0013294 _Iyear_1978 | -.0666255 .0195998 -3.40 0.001 -.1050404 -.0282107 _Iyear_1979 | -.0803878 .0195241 -4.12 0.000 -.1186543 -.0421212 _Iyear_1980 | -.0845393 .0198067 -4.27 0.000 -.1233598 -.0457189 _Iyear_1981 | -.1125847 .0217924 -5.17 0.000 -.1552971 -.0698724 _Iyear_1982 | -.1180702 .0225988 -5.22 0.000 -.162363 -.0737773 _Iyear_1983 | -.1170761 .0253322 -4.62 0.000 -.1667264 -.0674259 _Iyear_1984 | -.0844213 .0298113 -2.83 0.005 -.1428504 -.0259923 _cons | 1.549606 .4113648 3.77 0.000 .7433454 2.355866 -------------+---------------------------------------------------------------- sigma_u | .5055356 sigma_e | .12768701 rho | .94003031 (fraction of variance due to u_i) ------------------------------------------------------------------------------ . xi: xtreg n w k ys i.year, fe i(id) i.year _Iyear_1976-1984 (naturally coded; _Iyear_1976 omitted) Fixed-effects (within) regression Number of obs = 1031 Group variable (i): id Number of groups = 140 R-sq: within = 0.6321 Obs per group: min = 7 between = 0.8481 avg = 7.4 overall = 0.8349 max = 9 F(11,880) = 137.45 corr(u_i, Xb) = 0.5930 Prob > F = 0.0000 ------------------------------------------------------------------------------ n | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- w | -.2968768 .0553473 -5.36 0.000 -.405505 -.1882485 k | .5475598 .0217733 25.15 0.000 .5048261 .5902934 ys | .2648254 .0819989 3.23 0.001 .1038893 .4257616 _Iyear_1977 | -.0382327 .0187438 -2.04 0.042 -.0750204 -.001445 _Iyear_1978 | -.0638061 .0190658 -3.35 0.001 -.1012259 -.0263864 _Iyear_1979 | -.0746483 .0189938 -3.93 0.000 -.1119267 -.0373699 _Iyear_1980 | -.0763939 .0192734 -3.96 0.000 -.1142212 -.0385667 _Iyear_1981 | -.1071345 .0211646 -5.06 0.000 -.1486734 -.0655955 _Iyear_1982 | -.1233866 .0219401 -5.62 0.000 -.1664477 -.0803256 _Iyear_1983 | -.1274072 .0246385 -5.17 0.000 -.1757642 -.0790502 _Iyear_1984 | -.101978 .0290425 -3.51 0.000 -.1589787 -.0449774 _cons | 1.081303 .4040474 2.68 0.008 .2882943 1.874312 -------------+---------------------------------------------------------------- sigma_u | .66232129 sigma_e | .12768701 rho | .964165 (fraction of variance due to u_i) ------------------------------------------------------------------------------ F test that all u_i=0: F(139, 880) = 127.28 Prob > F = 0.0000 . xtgls n w k ys, i(id) t(year) Cross-sectional time-series FGLS regression Coefficients: generalized least squares Panels: homoskedastic Correlation: no autocorrelation Estimated covariances = 1 Number of obs = 1031 Estimated autocorrelations = 0 Number of groups = 140 Estimated coefficients = 4 Obs per group: min = 7 avg = 7.364286 max = 9 Wald chi2(3) = 5240.68 Log likelihood = -834.5829 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ n | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- w | -.3669498 .0645452 -5.69 0.000 -.4934561 -.2404435 k | .8090177 .0112307 72.04 0.000 .7870059 .8310296 ys | .4791144 .1806718 2.65 0.008 .1250042 .8332246 _cons | .3444255 .8588811 0.40 0.688 -1.33895 2.027801 ------------------------------------------------------------------------------ . xtgls n w k ys, i(id) t(year) panels(hetero) Cross-sectional time-series FGLS regression Coefficients: generalized least squares Panels: heteroskedastic Correlation: no autocorrelation Estimated covariances = 140 Number of obs = 1031 Estimated autocorrelations = 0 Number of groups = 140 Estimated coefficients = 4 Obs per group: min = 7 avg = 7.364286 max = 9 Wald chi2(3) = 40350.78 Log likelihood = -312.6003 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ n | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- w | -.3109114 .0339191 -9.17 0.000 -.3773915 -.2444312 k | .8181844 .004103 199.41 0.000 .8101427 .826226 ys | .4300364 .0591059 7.28 0.000 .314191 .5458818 _cons | .4224078 .3025395 1.40 0.163 -.1705587 1.015374 ------------------------------------------------------------------------------ . xtgls n w k ys, i(id) t(year) panels(correlated) panels must be balanced r(459); . xtgls n w k ys, i(id) t(year) panels(hetero) corr(ar1) Cross-sectional time-series FGLS regression Coefficients: generalized least squares Panels: heteroskedastic Correlation: common AR(1) coefficient for all panels (0.8699) Estimated covariances = 140 Number of obs = 1031 Estimated autocorrelations = 1 Number of groups = 140 Estimated coefficients = 4 Obs per group: min = 7 avg = 7.364286 max = 9 Wald chi2(3) = 6511.64 Log likelihood = 685.5039 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ n | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- w | -.2273026 .0380005 -5.98 0.000 -.3017823 -.1528229 k | .7691156 .0098878 77.78 0.000 .7497358 .7884954 ys | .302611 .057018 5.31 0.000 .1908579 .4143642 _cons | .7916942 .2893987 2.74 0.006 .2244832 1.358905 ------------------------------------------------------------------------------ . xtgls n w k ys, i(id) t(year) panels(hetero) corr(psar1) Cross-sectional time-series FGLS regression Coefficients: generalized least squares Panels: heteroskedastic Correlation: panel-specific AR(1) Estimated covariances = 140 Number of obs = 1031 Estimated autocorrelations = 140 Number of groups = 140 Estimated coefficients = 4 Obs per group: min = 7 avg = 7.364286 max = 9 Wald chi2(3) = 16313.05 Log likelihood = 939.0323 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ n | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- w | -.2461691 .0284753 -8.65 0.000 -.3019796 -.1903586 k | .7930714 .0063385 125.12 0.000 .7806482 .8054946 ys | .3104171 .0379433 8.18 0.000 .2360496 .3847847 _cons | .7652942 .2007306 3.81 0.000 .3718695 1.158719 ------------------------------------------------------------------------------ . do "C:\DOCUME~1\salon\CONFIG~1\Temp\STD000000.tmp" . use http://www.stata-press.com/data/r8/invest2, clear . end of do-file . do "C:\DOCUME~1\salon\CONFIG~1\Temp\STD000000.tmp" . xtgls invest market stock, i(company) t(time) panels(correlated) Cross-sectional time-series FGLS regression Coefficients: generalized least squares Panels: heteroskedastic with cross-sectional correlation Correlation: no autocorrelation Estimated covariances = 15 Number of obs = 100 Estimated autocorrelations = 0 Number of groups = 5 Estimated coefficients = 3 Time periods = 20 Wald chi2(2) = 1285.19 Log likelihood = -537.8045 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ invest | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- market | .0961894 .0054752 17.57 0.000 .0854583 .1069206 stock | .3095321 .0179851 17.21 0.000 .2742819 .3447822 _cons | -38.36128 5.344871 -7.18 0.000 -48.83703 -27.88552 ------------------------------------------------------------------------------ . ** correlated, heteroskedasticity, no autocorrelation . . end of do-file . xtgls invest market stock, i(company) t(time) panels(correlated corr(psar1) ) required r(100); . xtgls invest market stock, i(company) t(time) panels(correlated) corr(psar1) Cross-sectional time-series FGLS regression Coefficients: generalized least squares Panels: heteroskedastic with cross-sectional correlation Correlation: panel-specific AR(1) Estimated covariances = 15 Number of obs = 100 Estimated autocorrelations = 5 Number of groups = 5 Estimated coefficients = 3 Time periods = 20 Wald chi2(2) = 331.55 Log likelihood = -484.6178 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ invest | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- market | .0820264 .0081381 10.08 0.000 .066076 .0979767 stock | .3800689 .0313874 12.11 0.000 .3185508 .441587 _cons | -11.51848 12.69055 -0.91 0.364 -36.39151 13.35455 ------------------------------------------------------------------------------ . do "C:\DOCUME~1\salon\CONFIG~1\Temp\STD000000.tmp" . xtgls invest market stock, i(company) t(time) panels(correlated) Cross-sectional time-series FGLS regression Coefficients: generalized least squares Panels: heteroskedastic with cross-sectional correlation Correlation: no autocorrelation Estimated covariances = 15 Number of obs = 100 Estimated autocorrelations = 0 Number of groups = 5 Estimated coefficients = 3 Time periods = 20 Wald chi2(2) = 1285.19 Log likelihood = -537.8045 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ invest | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- market | .0961894 .0054752 17.57 0.000 .0854583 .1069206 stock | .3095321 .0179851 17.21 0.000 .2742819 .3447822 _cons | -38.36128 5.344871 -7.18 0.000 -48.83703 -27.88552 ------------------------------------------------------------------------------ . ** correlated, heteroskedasticity, no autocorrelation . . end of do-file . help xtlogit . help xtprobit . help xtgls . help xtlogit . log close log: C:\Documents and Settings\salon\Escritorio\clase17mar.log log type: text closed on: 18 Mar 2005, 17:10:26 -----------------------------------------------------------------------------------