Transformation of sur equations
[x,y,boundsvarb,prests,listcoef,namey,ncoefeqs]=explosys(namecoef,specara,speccarb,uneven,dropna,arg1,...,argn)
* namecoef = column vector of coefficients name
* speccara = column vector of characters that must be found after the name of a coefficient
* speccarb = column vector of characters that must befound after the name of a coefficient
* uneven = a boolean indicating whether the equations should keep their time bounds or must have common bounds
* dropna = a boolean indicating whether the program should keep only lines of matrices y and x with non NA values
* argi = an equation containing the coefficients named in namecoef or 'unbal' for un unabalanced panel in a sur estimation (in that case must be in the first position)
* x = (nobs x k) matrix of exogenous variables in the complete model
* y = (nobs x 1) vector of endogenous variables in the complete model
* boundsvarb = bounds (if any) of the regression
* prests = a boolean indicating the presence or absence of ts in the regressions
* listcoef = list of indexes of the coefficients in each equation
* namey = column vector of the names of the endogenous variables
* ncoefeqs = column vector of the # of coefficients in each equation
load(GROCERDIR+'/data/grun.dat') // grunfeld investment data // see page 650, Green 1997 ige = grun(:,1); // general electric fge = grun(:,2); cge = grun(:,3); iwest = grun(:,4); // westinghouse fwest = grun(:,5); cwest = grun(:,6); igm = grun(:,7); // general motors fgm = grun(:,8); cgm = grun(:,9); ich = grun(:,10); // chrysler fch = grun(:,11); cch = grun(:,12); iuss = grun(:,13); // us steel fuss = grun(:,14); cuss = grun(:,15); eq1='igm=a1*fgm+a2*cgm+a3' eq2='ich=a4*fch+a5*cch+a6' eq3='ige=a7*fge+a8*cge+a9' eq4='iwest=a10*fwest+a11*cwest+a12' eq5='iuss=a13*fuss+a14*cuss+a15' [x,y,grocer_boundsvarb,grocer_prests,listcoef,namey,ncoefeqs]=explosys('a'+string([1:15]'),['+' ; '-' ; '*' ; '/' ; ')'],... ['=' ; '+' ; '(' ; '-' ; '*'],%f,%f,eq1,eq2,eq3,eq4,eq5) [x,y,grocer_boundsvarb,grocer_prests,listcoef,namey,ncoefeqs]=... explosys(grocer_namecoef,grocer_speccara,grocer_speccarb,varargin(:)) // This example is adapted from function sur_d, applying the sur method to Greene textbook example. | ![]() | ![]() |