【正文】
ysis ? */ ? /* ? ** Set more input control variables if needed, for model prediction ? ** (. _b for estimated parameters) ? */ ? call forecast(y,x)。 using GPE package (version 2) ? // this must be the first executable statement ? /* ? ** Writing output to file or sending it to printer: ? ** specify file name for output ? */ ? // Loading data: read data series from data files. ? /* ? ** Generating or transforming data series: ? ** create and generate variables with data scaling or transformation ? ** (. y and x are generated here and will be used below) ? */ ? call reset。 endp。 endo。 y = y~qtoa1(x[.,i])。 i = 2。 c = cols(x)。 local r,c,y,i。)。 endo。 print invx。 invx=invpd(x39。x)。 print e = e。 do until e 。X can be inverted? 11110000 0 00 0 0000eeee????????????????one=ones(1,4)。s numerical calculation? This example addresses this important problem. Suppose e is a known small positive number, and the 5x4 matrix X is defined as follows: Verify that the eigenvalues of X39。 endp。 ... statements in the body of procedure。 ? Procedure proc [[(nrets)=]] proc_name(arg_list)。 do until ... endo。 ... endfor。 endif。 else。(transpose) ? Useful Algrbra and Matrix Operations exp ln log abs sqrt pi sin cos inv invpd(inverse) det(determinant) ? Example ? Least Squares: b=y/x GAUSS Programming Useful GAUSS Functions ? System Functions: use, load, output ? Data Generating Functions: ones, zeros, eye, seqa, seqm, rndu, rndn ? Data Conversion Functions: reshape, selif, delif, vec, vech, xpnd, submat, diag, diagrv ? Basic Matrix Functions: ? Matrix Description: rows, cols, maxc, minc, meanc, median, stdc ? Matrix Operations: sumc,cumsumc,prodc,cumprodc,sortc,sorthc,sortind ? Matrix Computation: det,inv,invpd,solpd,vcx,corrx,cond,rank,eig,eigh ? Probability and Statistical Functions: pdfn, cdfn, cdftc, cdffc, cdfchic, dstat, ols ? Calculus Functions: gradp, hessp, intsimp, linsolve, eqsolve, sqpsolve GAUSS Programming Controlling Execution Flow ? If Statement if。* *2* * * *( 1 ) ( 1 )( , , , ) l n( 2 ) l n( )22( 1 ) l n | | ( 1 ) l n | |2( ) , ( )( , , | , , ) ( ) ( ) ( )vvvNNT T TN T N TLT A T Bw he re A I W B I WW I B I A I B? ? ? ? ????????? ? ?? ? ? ? ?? ? ? ?? ? ? ? ? ?βeeee β y X y X βMaximum Likelihood Estimation Random Effects ? LogLikelihood Function 2239。~ ( , ) ,TNu T v T T T TN??? ? ? ? ? ?? ? ? ?e i u v 0 Ω Ω IJ I J i i22~ ( , ) , ~ ( , ) ,v N T u NN N t?? ?v 0 I u 0 IT??e i u + vMaximum Likelihood Estimation Fixed Effects ? LogLikelihood Function 222( , , , ) l n( 2 ) l n( )2239。 39。 ) /( 39。 ) /( 39。 ) /( 39。 ) / ( 1 )( 39。 ) /( 39。 ) / ( 1 )( 39。 /? ?? ? ? ?( ) , ( )TF E F E i ittvuu T v T N u T v T Nv v TN T N??? ? ? ???? ? ?? ? ? ?? ? ?? ? ? ? ? ??δ Z Z Z y v y Z δv v v vΩ J I I Ω J I ISpatial Error Model Estimation ? The Model: SPAR(1) ? Fixed Effects ? Random Effects ()TTWi???? ? ?? ? ?yX βεε I ε ee u v2 2 2 2 211(,( ) ,v u vT T N T NV a r T? ? ? ? ?? ? ? ?? ? ? ? ?11e ) Q I J I Q J I2( ) ( ) v NTV a r V a r ???e v I11( ) ( ) ( ) ( ) 39。 , , /? ? ? ?? ?39。 )V a r? ? ? ? ???δ Z Ω ZZ Ω y δ Z Ω Z11222 2 1 2 2? ?? ? ? ? ?( 39。 ) 39。 ) 39。? ?( ) ( 39。??Z H H H H Z2( | ) 0 , ( , ) 0, TE C o vw h e re W????? ? ???v H Z HH X W X W X W ISpatial Lag Model Estimation ? Random Effects 22( ) ( )Tu T v T NV ar ????? ? ?? ? ? ?yZ δεε i u vε Ω J I I2 2 2 2 211 ,( ) ,v u vT T N T NTw h e r e? ? ? ? ?? ? ? ?? ? ? ? ?11Ω Q I J I Q J ISpatial Lag Model Estimation Random Effects: IV/GLS ? Instrumental Variables ? TwoStage Generalized Least Squares 1 1 111? ? ?( 39。 / ( 1 ) ,vvVarNT??????? ? ? ?δ Z Z Z y δ ZZv v v y Z δ1? ( 39。 , ( ) ( 39。T W????? ? ?Z I y XδβyZ δεSpatial Lag Model Estimation ? Fixed Effects 2 2( ) ( ) ()Tv N T vV a r V a r V a r? ?? ? ? ? ?? ????????? ?? ?? ?yZ δ i u v yZ δvε v I vQ,()T T Nw h e r e? ? ?y = Q y Z = Q Z v = Q vQ I J ISpatial Lag Model Estimation Fixed Effects: IV or 2SLS ? Instrumental Variables ? TwoStage Least Squares 1 2 12? ? ?? ? ?( 39。 )u T v T