{smcl} {com}{sf}{ul off}{txt}{.-} name: {res} {txt}log: {res}Z:\PUBLIC_web\Stataworkshops\Postfiles\jackknife_postfile.smcl {txt}log type: {res}smcl {txt}opened on: {res}21 Nov 2014, 10:11:30 {com}. do "Z:\PUBLIC_web\Stataworkshops\Postfiles\jackknife postfile.do" {txt} {com}. /* > # Markdoc demo > Use the automobile data set. Demonstrate the **jackknife** command. > */ . sysuse auto {txt}(1978 Automobile Data) {com}. . regress price mpg weight foreign {txt}Source {c |} SS df MS Number of obs ={res} 74 {txt}{hline 13}{char +}{hline 30} F( 3, 70) ={res} 23.29 {txt} Model {char |} {res} 317252881 3 105750960 {txt}Prob > F = {res} 0.0000 {txt}Residual {char |} {res} 317812515 70 4540178.78 {txt}R-squared = {res} 0.4996 {txt}{hline 13}{char +}{hline 30} Adj R-squared = {res} 0.4781 {txt} Total {char |} {res} 635065396 73 8699525.97 {txt}Root MSE = {res} 2130.8 {txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {col 1} price{col 14}{c |} Coef.{col 26} Std. Err.{col 38} t{col 46} P>|t|{col 54} [95% Con{col 67}f. Interval] {hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {space 9}mpg {c |}{col 14}{res}{space 2} 21.8536{col 26}{space 2} 74.22114{col 37}{space 1} 0.29{col 46}{space 3}0.769{col 54}{space 4}-126.1758{col 67}{space 3} 169.883 {txt}{space 6}weight {c |}{col 14}{res}{space 2} 3.464706{col 26}{space 2} .630749{col 37}{space 1} 5.49{col 46}{space 3}0.000{col 54}{space 4} 2.206717{col 67}{space 3} 4.722695 {txt}{space 5}foreign {c |}{col 14}{res}{space 2} 3673.06{col 26}{space 2} 683.9783{col 37}{space 1} 5.37{col 46}{space 3}0.000{col 54}{space 4} 2308.909{col 67}{space 3} 5037.212 {txt}{space 7}_cons {c |}{col 14}{res}{space 2}-5853.696{col 26}{space 2} 3376.987{col 37}{space 1} -1.73{col 46}{space 3}0.087{col 54}{space 4}-12588.88{col 67}{space 3} 881.4934 {txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {res}{txt} {com}. jackknife coef=_b[mpg]: regress price mpg weight foreign {txt}(running regress on estimation sample) Jackknife replications ({res}74{txt}) {hline 4}{c +}{hline 3} 1 {hline 3}{c +}{hline 3} 2 {hline 3}{c +}{hline 3} 3 {hline 3}{c +}{hline 3} 4 {hline 3}{c +}{hline 3} 5 .................................................. 50 ........................ {res} {txt}Linear regression{col 49}Number of obs{col 68}= {res} 74 {txt}{col 49}Replications{col 68}= {res} 74 {p2colset 7 17 21 2}{...} {txt}{p2col :command:}regress price mpg weight foreign{p_end} {p2colset 10 17 21 2}{...} {p2col :coef:}{res:_b[mpg]}{p_end} n(): {res}e(N) {txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {col 14}{c |}{col 26} Jackknife {col 14}{c |} Coef.{col 26} Std. Err.{col 38} t{col 46} P>|t|{col 54} [95% Con{col 67}f. Interval] {hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {space 8}coef {c |}{col 14}{res}{space 2} 21.8536{col 26}{space 2} 87.57669{col 37}{space 1} 0.25{col 46}{space 3}0.804{col 54}{space 4}-152.6865{col 67}{space 3} 196.3937 {txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. /* > Produce the same results using **postfile**. > */ . postfile coeffs b se using "coeffs.dta", replace {txt}(note: file coeffs.dta not found) {com}. . forvalues i = 1/74 {c -(} {txt} 2{com}. quietly regress price mpg weight foreign if _n~=`i' {txt} 3{com}. local b _b[mpg] {txt} 4{com}. local se _se[mpg] {txt} 5{com}. post coeffs (`b') (`se') {txt} 6{com}. {c )-} {txt} {com}. . postclose coeffs {txt} {com}. . use "coeffs.dta", clear {txt} {com}. summarize b se {txt} Variable {c |} Obs Mean Std. Dev. Min Max {hline 13}{c +}{hline 56} {space 11}b {c |}{res} 74 21.87022 10.32004 -45.60361 44.3121 {txt}{space 10}se {c |}{res} 74 74.78354 1.872273 69.52323 87.14951 {txt} {com}. ci se {txt} Variable {c |} Obs Mean Std. Err. [95% Conf. Interval] {hline 13}{c +}{hline 63} se {c |}{col 16}{res} 74{col 29} 74.78354{col 41} .2176474{col 57} 74.34977{col 69} 75.21732{txt} {com}. {txt}end of do-file {com}. log close {txt}name: {res} {txt}log: {res}Z:\PUBLIC_web\Stataworkshops\Postfiles\jackknife_postfile.smcl {txt}log type: {res}smcl {txt}closed on: {res}21 Nov 2014, 10:12:36 {txt}{.-} {smcl} {txt}{sf}{ul off}