Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
16
Добавлен:
23.03.2015
Размер:
5.25 Кб
Скачать

Sample Programs td.btop {border-top: 1px solid black} td.bbot {border-bottom: 1px solid black} td.bleft {border-left: 1px solid black} td.bright {border-right: 1px solid black} td.center {text-align:center} td.left {text-align:left} td.right {text-align:right} td.bottom {vertical-align:bottom} td.underline {text-decoration:underline} td.strikeout {text-decoration:line-through} td.indent1 {text-indent:1} td.bgcolor {background-color:#000000} td.ftcolor {color:#000000} hr.width100 {width: 100%} hr.black {color:#000000} td.btop {border-top: 1px solid black} td.bbot {border-bottom: 1px solid black} td.bleft {border-left: 1px solid black} td.bright {border-right: 1px solid black} td.center {text-align:center} td.left {text-align:left} td.right {text-align:right} td.bottom {vertical-align:bottom} td.underline {text-decoration:underline} td.strikeout {text-decoration:line-through} td.indent1 {text-indent:1} td.bgcolor {background-color:#000000} td.ftcolor {color:#000000} hr.width100 {width: 100%} hr.black {color:#000000} Pool Between group estimation for pooled data (between.prg) Hausman test for fixed versus random effects (hausman.prg) Between group estimation for pooled data BETWEEN.PRG stores the cross-section specific means of each series in a matrix, creates a new workfile, converts the matrix to series, and runs the between groups regression. ' between group esitmation for pool ' revised for version 5.0 (3/25/2004) 'change path to program path %path = @runpath cd %path ' load workfile load ..\data\pool1 ' define pool smpl @all pool pool1.add aut bus con cst dep hoa mae mis ' set number of cross-sections !ncross = pool1.@ncross ' create group with variables pool1.makegroup(tempgrp) log(ivm?) log(mm?) ' store means of two series in matrix matrix(!ncross,2) means series tempser for !i = 1 to !ncross tempser = tempgrp(!i) means(!i,1) = @mean(tempser) tempser = tempgrp(!ncross+!i) means(!i,2) = @mean(tempser) next store(i) means delete tempgrp tempser ' create new workfile and fetch means matrix wfcreate between u 1 !ncross fetch(i) means ' convert matrix to series series lc_mean series ly_mean group g1 lc_mean ly_mean mtos(means,g1) ' run between groups regression and cleanup equation eq_bet.ls lc_mean c ly_mean show eq_bet ^Top

Hausman test for fixed versus random effects HAUSMAN.PRG computes the Hausman test statistic for testing the null hypothesis that the fixed and random effects models do not differ systematically. The program estimates a fixed and random effects model with two slope regressors and stores the estimated coefficients and its covariance matrix. (The version of the  Grunfeld data used in this example is transcribed from Greene (1997), Table 15.1.). ' hausman test for fixed versus random effects ' revised for version 5.0 (3/28/2004) 'change path to program path %path = @runpath cd %path ' load workfile load ..\data\grunfeld ' set sample smpl @first 1947 ' estimate fixed effects and store results pool1.ls(cx=f) log(inv?) log(val?) log(cap?) vector beta = pool1.@coefs matrix covar = pool1.@cov ' keep only slope coefficients vector b_fixed = @subextract(beta,1,1,2,1) matrix cov_fixed = @subextract(covar,1,1,2,2) ' estimate random effects and store results pool1.ls(cx=r) log(inv?) log(val?) log(cap?) beta = pool1.@coefs covar = pool1.@cov ' keep only slope coefficients vector b_gls = @subextract(beta,2,1,3,1) matrix cov_gls = @subextract(covar,2,2,3,3) ' compute Hausman test stat matrix b_diff = b_fixed - b_gls matrix var_diff = cov_fixed - cov_gls matrix qform = @transpose(b_diff)*@inverse(var_diff)*b_diff if qform(1,1)>=0 then ' set table to store results table(4,2) result setcolwidth(result,1,20) setcell(result,1,1,"Hausman test for fixed versus random effects") setline(result,2) !df = @rows(b_diff) setcell(result,3,1,"chi-sqr(" + @str(!df) + ") = ") setcell(result,3,2,qform(1,1)) setcell(result,4,1,"p-value = ") setcell(result,4,2,1-@cchisq(qform(1,1),!df)) setline(result,5) show result else statusline "Quadratic form is negative" endif ^Top

Соседние файлы в папке docs