Dear Listers,
I tried to run the below code, but I have got the following error synthaxes:
Syntax error G0008 : 'else' :
Syntax error G0008 : 'endif'
Syntax error G0008 : 'starts = round((((fsp-ffobs)*freq)+1)) endsp = round((((fep-ffobs)*freq)+1)) dat'
Thank you for your kind help,
N.K
****************************************************************************************
new 2000,320000
/* Program version: May 31, 1999 */
run C:\gauss10\Balcilar\msvar\setup.mod
/* Fix data matrix and obs to match selected sample */
load data[434,2]=C:\gauss10\Balcilar\msvar\data\ymm5995.asc;
if freq == 1
fsp = sp
fep = ep
ffobs = fobs
else
fsp = sp-(1/(2*freq))
fep = ep-(1/(2*freq))
ffobs = fobs-(1/(2*freq))
endif
startsp = round((((fsp-ffobs)*freq)+1))
endsp = round((((fep-ffobs)*freq)+1))
data = data[startsp:endsp,.]
obs = rows(data)
/* Prefilter seasonals from the data using dummies */
if preremov == 1
run C:\gauss10\Balcilar\msvar\programs\searemov.pgm
endif
if m == 1 or m == 2 or m == 3 or m == 4 or m == 5
m1 = 1
m2 = 0
k = q^2
k1 = q
k2 = 1
elseif m == 6
m1 = 1
m2 = 0
k = q^(p+1)
k1 = q^p
k2 = q^(p-1)
elseif m == 7 or m == 8 or m == 9
m1 = 1
m2 = 1
k = q^2
k1 = q
k2 = 1
else
m1 = 0
m2 = 0
endif
if m1 == 0
print " "
print " You have NOT selected a model.
Must be Q playing with your
mind again!";
end
endif
if m2 == 0 and p == 0
print " "
print " You have forgotten to select lags.
Must be all that Romulan ale last night!";
end
endif
if dv == 0 and Sea ne 0
print " You have selected dummy seasonals
and NO deterministic variables
(dv=0). Program NOT executed!";
end
elseif dv == 0 and Trend ne 0
print " You have selected a linear deter-
ministic trend and NO deterministic
variables (dv=0).
Program NOT executed!";
end
endif
if qs >= 2 and q ne 2^qs
print " Your specifications of q and qs
are NOT compatible.
Programs NOT executed!";
end
endif
if qs >= 2 and sump == 1
print " You have selected sump=1 and
qs>1. Option not available.
Program NOT executed!";
end
endif
if m == 7
mh = 7
m = 1
elseif m == 8
mh = 8
m = 2
elseif m == 9
mh = 9
m = 5
endif
if Trend == 0 and Sea == 0
trend1 = 1
else
trend1 = 0
endif
if trend1 == 1 and dv == 1
print " You have selected deterministic
variables (dv=1), but not specified
a linear trend or seasonals.
Program NOT executed!";
end
endif
/* Constructing data matrices */
T = obs-p
if dv == 1 and sea == 0
d = Trend
elseif dv == 1 and sea == 4 or sea == 12
d = Trend+sea-1
else
d = 0
endif
y = data[(p+1):obs,.]'
if p >= 1
xmat = data[p:(obs-1),.]'
j = 2
do while j <= p
xmat = xmat|(data[(p+1-j):(obs-j),.]')
j = j+1
endo
endif
conmat = ones(1,T)
/* Defining the variable dtrend */
if Trend == 1 and d >= 1
dtrend = seqa(1,1,T)'
/* we read the data for conditioning variable */
dtrend = zmat
d = cols(zmat)
endif
/* Defining the centered seasonal dummies */
if sea == 4 and d >= 3
seamat = zeros(3,T)
j = 1
do while j <= 3
i = j
do while i <= T
seamat[j,i] = 1
i = i+4
endo
j = j+1
endo
adjsea = (1/4)*ones(3,T)
seamat = seamat - adjsea
elseif sea == 12 and d>= 11
seamat = zeros(11,T)
j = 1
do while j <= 11
i = j
do while i <= T
seamat[j,i] = 1
i = i+12
endo
j = j+1
endo
adjsea = (1/12)*ones(11,T)
seamat = seamat - adjsea
endif
if Trend == 1 and sea == 4 or sea == 12
dmat = dtrend|seamat
elseif Trend == 0 and sea == 4 or sea == 12
dmat = seamat
elseif Trend == 1 and d == 1
dmat = dtrend
endif
if d == 0 and p >= 1
ymat = conmat|xmat
elseif d == 0 and p == 0
ymat = conmat
elseif d >= 1 and p >= 1
ymat = conmat|dmat|xmat
else
ymat = conmat|dmat
endif
if m >= 3 and m <= 4 and d >= 1
xmat = dmat|xmat
endif
/* Setting up the n*n by n*(n+1)/2 Duplication matrix */
Dupn = zeros(n*n,n*(n+1)/2)
dnel2 = 0
j = 1
do while j <= n
i = 1
do while i <= n-j+1
dnel2 = dnel2+1
Dupn[i+(n+1)*(j-1),dnel2] = 1
i = i+1
endo
j = j+1
endo
if n > 1
j = 1
do while j <= n-1
dnstar = 1
i = 1
do while i <= j
Dupn[i+n*j,dnstar+j-i+1] = 1
dnstar = dnstar+n-i+1
i = i+1
endo
j = j+1
endo
endif
DMP = invpd(Dupn'*Dupn)*Dupn'
/* Setting up a selection matrix for mu(i) in model 6 */
if m == 6
musel = eye(q) .*. ones(1,q^p)
j = 1
do while j <= p
muselj = ones(1,q^j) .*. (eye(q) .*. ones(1,q^(p-j)))
musel = musel|muselj
j = j+1
endo
commute = zeros(q*(p+1),q*(p+1))
i = 1
do while i <= p+1
j = 1
do while j <= q
commute[j+q*(i-1),i+(p+1)*(j-1)] = 1
j = j+1
endo
i = i+1
endo
musel = commute'*musel
endif
/* Starting the iterations */
if rest >= 1
lambda = zeros(rest,1)
if m == 1
selV = eye(n)~zeros(n,n*(q-1))
theta = vec(selV*A)
omega = DMP*vec(selV*V)
i = 2
do while i <= q
selVi = zeros(n,n*q)
j = 1
do while j <= n
selVi[j,j+n*(i-1)] = 1
j = j+1
endo
theta = theta|(vec(selVi*A))
omega = omega|(DMP*vec(selVi*V))
i = i+1
endo
theta = theta|omega
elseif m == 2
selV = eye(n)~zeros(n,n*(q-1))
theta = vec(selV*A)
omega = DMP*vec(selV*V)
i = 2
do while i <= q
selAi = zeros(n,n*q)
j = 1
do while j <= n
selAi[j,j+n*(i-1)] = 1
j = j+1
endo
theta = theta|(vec(selAi*A))
i = i+1
endo
theta = theta|omega
elseif m == 3
mu = A[.,1]
selAr = eye(n)~zeros(n,n*(q-1))
selAc = zeros(1,n*p+d)|eye(n*p+d)
Amat = selAr*A*selAc
theta = mu|(vec(Amat))
i = 1
do while i <= q
selVi = zeros(n,n*q)
j = 1
do while j <= n
selVi[j,j+n*(i-1)] = 1
j = j+1
endo
Vmati = selVi*V
theta = theta|(DMP*vec(Vmati))
i = i+1
endo
elseif m == 4
mu = A[.,1]
selAr = eye(n)~zeros(n,n*(q-1))
selAc = zeros(1,n*p+d)|eye(n*p+d)
Amat = selAr*A*selAc
Vmat = selAr*V
theta = mu|(vec(Amat))|(DMP*vec(Vmat))
elseif m == 5
selV = eye(n)~zeros(n,n*(q-1))
theta = vec(selV*A)
omega = DMP*vec(selV*V)
i = 2
do while i <= q
selVi = zeros(n,n*q)
j = 1
do while j <= n
selVi[j,j+n*(i-1)] = 1
j = j+1
endo
omega = omega|(DMP*vec(selVi*V))
i = i+1
endo
theta = theta|omega
elseif m == 6
mu = A[.,1]
selV = eye(n)~zeros(n,n*(q-1))
selAc = zeros(1,n*p+d)|eye(n*p+d)
Amat = selV*A*selAc
Vmat = selV*V
theta = mu|(vec(Amat))|(DMP*vec(Vmat))
endif
fthetab = Rmat*theta-rvec
restchek = maxc(abs(fthetab))
if restchek ne 0 and check == 1
print " "
print " The initial parameter values
you have selected do NOT meet
the restrictions.
Program NOT executed!";
end
else
Rort = null(Rmat)
endif
endif
Ainit = A
Vinit = V
Pinit = Pmat
rho = (1/k)*ones(k,1)
lnL = 0
dlnL = 0
maxpar = 100
maxgr = 100
begini = sp
endini = sp+((p-1)/freq)
begest = sp+(p/freq)
endest = ep
begini1 = trunc(begini)
endini1 = trunc(endini)
begest1 = trunc(begest)
endest1 = trunc(endest)
if freq ne 1
begini2 = begini+(1/(2*freq))
endini2 = endini+(1/(2*freq))
begest2 = begest+(1/(2*freq))
endest2 = endest+(1/(2*freq))
begini3 = round(((begini2-begini1)*freq))
endini3 = round(((endini2-endini1)*freq))
begest3 = round(((begest2-begest1)*freq))
endest3 = round(((endest2-endest1)*freq))
estsamp = "Estimation period: "$+ ftocv(begest1,2,0)$+ ":"$+ ftocv(begest3,1,0)$+ "-"$+ ftocv
(endest1,2,0)$+ ":"$+ ftocv(endest3,1,0)
if p == 0
inisamp = "Initial observations: None"
else
inisamp = "Initial observations: "$+ ftocv(begini1,2,0)$+ ":"$+ ftocv(begini3,1,0)$+ "-"$+ ftocv
(endini1,2,0)$+ ":"$+ ftocv(endini3,1,0)
endif
else
estsamp = "Estimation period: "$+ ftocv(begest1,2,0)$+ "-"$+ ftocv(endest1,2,0)
if p == 0
inisamp = "Initial observations: None"
else
inisamp = "Initial observations: "$+ ftocv(begini,2,0)$+ "-"$+ ftocv(endini,2,0)
endif
endif
mstr = "Variables for model "$+ ftocv(m,1,0)$+ ":"
estsamp1 = " "$+ estsamp
inisamp1 = " "$+ inisamp
numobs = "Number of observations: "$+ ftocv(T,2,0)
numobs1 = " "$+ numobs
nstates1 = seqa(1,1,q)
if qs >= 2
statesel = eye(2) .*. ones(1,2^(qs-1))
i = 1
do while i <= qs-1
statesi = ones(1,2^i) .*. (eye(2) .*. ones(1,2^(qs-1-i)))
statesel = statesel|statesi
i = i+1
endo
comsel = zeros(2*qs,2*qs)
i = 1
do while i <= qs
j = 1
do while j <= 2
comsel[j+2*(i-1),i+qs*(j-1)] = 1
j = j+1
endo
i = i+1
endo
statesel = comsel'*statesel
statesej = reshape(statesel[.,1],2,qs)'
state1 = seqa(1,1,2)
states = statesej*state1
j = 2
do while j <= q
statesej = reshape(statesel[.,j],2,qs)'
states = states~(statesej*state1)
j = j+1
endo
nstates1 = nstates1~(states')
endif
if qs == 1
ejstr = " State Est #obs"
elseif qs >= 2
ejstr = " State Regime var's 1 to "$+ ftocv(qs,1,0)$+ " Est #obs"
endif
headmsg = " ESTIMATING MS("$+ ftocv(q,1,0)$+ ")-VAR("$+ ftocv(p,1,0)$+ ") MODEL "$+ ftocv(m,1,0)$+ " FOR: "$+ mvars
headund = " ="
headw = strlen(headmsg)
i = 9
do while i <= headw
headund = headund$+ "="
i = i+1
endo
output off
format /M1 /ROS 10,6
cls
locate csrlin,csrcol
print ""
print headmsg
print headund
print " "
it = 1
iterate:
do while it<=maxit and maxpar>convcrit and maxgr>convcrit and m1==1
run C:\gauss10\Balcilar\msvar\programs\smooth.pgm
run C:\gauss10\Balcilar\msvar\programs\gradient.pgm
if maxgr > convcrit
run C:\gauss10\Balcilar\msvar\programs\estimate.pgm
endif
if it == 1
values = " "$+ ftocv(it,1,0)$+ " "$+ ftocv(lnL,1,6)$+ " "$+ ftocv(dlnL,1,6)$+ " "$+ ftocv(maxpar,1,6)$+ " "$+
ftocv(maxgr,1,6)
elseif it < 10 and it > 1
values1 = " "$+ ftocv(it,1,0)$+ " "$+ ftocv(lnL,1,6)$+ " "$+ ftocv(dlnL,1,6)$+ " "$+ ftocv(maxpar,1,6)$+ " "$+
ftocv(maxgr,1,6)
values = values$| values1
elseif it < 100 and it > 9
values1 = " "$+ ftocv(it,1,0)$+ " "$+ ftocv(lnL,1,6)$+ " "$+ ftocv(dlnL,1,6)$+ " "$+ ftocv(maxpar,1,6)$+ " "$+
ftocv(maxgr,1,6)
values = values$| values1
else
values1 = " "$+ ftocv(it,1,0)$+ " "$+ ftocv(lnL,1,6)$+ " "$+ ftocv(dlnL,1,6)$+ " "$+ ftocv(maxpar,1,6)$+ " "$+
ftocv(maxgr,1,6)
values = values$| values1
endif
nstates = nstates1~(piT*imathT)
nstates2 = " "$+ ftocv(nstates,1,0)
itmsg = " Iteration number: "$+ ftocv(it,1,0)
lnlmsg = " Current value of log Likelihood: "$+ ftocv(lnL,1,6)
mparmsg = " Maximum absolute parameter change: "$+ ftocv(maxpar,1,8)
mgrmsg = " Maximum absolute gradient element: "$+ ftocv(maxgr,1,8)
print itmsg
print " "
print lnlmsg
print mparmsg
print mgrmsg
if p >= 1
karlmsg = " Largest system eigenvalue: "$+ ftocv(maxc(Amod),1,6)
karlmsg2 = " (Stationarity condition)"
print karlmsg
print karlmsg2
endif
print " "
print estsamp1
print inisamp1
print numobs1
print " "
print ejstr
print nstates2
print " "
if p >= 1
backline=csrlin-15-q
else
backline=csrlin-13-q
endif
locate backline,1
it = it+1
endo
output on
screen on
print "A =" A
print "V =" V
if m1 == 1 and it <= maxit
run C:\gauss10\Balcilar\msvar\programs\conscore.pgm
run C:\gauss10\Balcilar\msvar\programs\standerr.pgm
if rest == 0 and sump ne 1
run C:\gauss10\Balcilar\msvar\programs\misspec.pgm
endif
infocrit = (2*((s-rest)-lnL))/T
bic = (2*(((s-rest)*ln(T))-lnL))/T
lil = (2*(((s-rest)*ln(ln(T)))-lnL))/T
infocrit = infocrit~bic~lil
endif
output on
screen off
if m2 == 1
m = mh
endif
if m1 == 1 and it > maxit
screen on
output off
if p>=1
forward=csrlin+15
else
forward=csrlin+13
endif
locate forward,1
print ""
print ""
print " ***************************************************************"
print " ***************************************************************"
print " *** ***"
print " *** W A R N I N G ! W A R N I N G ! W A R N I N G ! ***"
print " *** ***"
print " ***************************************************************"
print " ***************************************************************"
print ""
print ""
print " **** ITERATIONS HAVE NOT CONVERGED ****"
print " "
print ""
print "If you would like to continue the iterations, please enter a new value for"
print "the maximum number of iterations (otherwise, select any integer and press"
print "enter)."
print ""
maxitnew = con(1,1)
maxitnew = trunc(maxitnew)
if maxitnew > maxit
maxit = maxitnew
cls
locate csrlin,csrcol
print ""
print headmsg
print headund
print " "
goto iterate
else
screen off
output on
endif
/* Perhaps add some options */
endif
if m1 == 1
print
iteration lnL difflnL maxpar diff maxgradient
print values
endif
if m1 == 1 and it <= maxit
print " "
print "********************************************************************"
print " "
print mstr
print " "
print mvars
print " "
print estsamp
print inisamp
print " "
print numobs
print " "
print ejstr
print nstates2
print " "
if p >= 1
if (maxc(Amod)) >= 1
print "WARNING! The estimated parameters are not
consistent with the 2nd order stationarity
condition of Karlsen.";
print " "
endif
if (maxc(Amod)) < 1 and d == 0
run C:\gauss10\Balcilar\msvar\programs\meanvar.pgm
run C:\gauss10\Balcilar\msvar\programs\mvstd.pgm
endif
endif
print "Initial values of A"
print Ainit
print " "
print "Initial values of V"
print Vinit
print " "
print "Initial values of Pmat"
print Pinit
print " "
print "These are the ML estimates of A"
print A
print " "
print "Standard errors based on the conditional scores"
print Aerror1
print " "
print "These are the ML estimates of V"
print V
print " "
print "Standard errors based on the conditional scores"
print Verror1
print " "
print "These are the ML estimates of the Markov probabilities"
if qs == 1
print Pmat
print " "
else
print p0q
print " "
endif
print "Standard errors based on the conditional scores"
print Perror1
print " "
if rest == 0 and p>=1
print "Nyblom tests for parameter stability"
print " "
print " Markov .90 .95 .99"
print Np0
print " "
print " mu .90 .95 .99"
print Nmu
print " "
print " Res cov .90 .95 .99"
print Noma
print " "
print "Nyblom tests for parameter stab in eq (rows) / state (cols)"
print Nyeqst
print " "
if n*p+d+2 <= 20
print " Critical values"
print " .90 .95 .99"
print Nyeqstcv
print " "
endif
endif
if sump ne 1
print "Wald test of serially uncorrelated Markov chain"
print " "
print Wald
print " "
print "with marginal level of significance"
print " "
print Waldpv
print " "
print "F-test of serially uncorrelated Markov chain"
print " "
print Waldf
print " "
print "with marginal level of significance"
print " "
print Waldfpv
print " "
endif
if qs >= 2
print "Wald and F-tests of no serial correlation
for each independent Markov chain";
print " "
print "regime variable Wald F"
print (seqa(1,1,qs))~Wald1~Wald1f
print " "
print "with marginal levels of significance"
print " "
print (seqa(1,1,qs))~Wald1pv~Wald1fpv
print " "
endif
if p >= 1
if (maxc(Amod)) < 1 and d == 0
print "First two moments conditional on s(t)"
print " Mean Covariance"
print dely~convy
print " "
print "Standard errors based on conditional scores"
print "and the Delta method using numerical partials"
print stddely~seconvy
print " "
print "First two moments"
print " Mean Covariance"
print muy~vy
print " "
print "Standard errors based on conditional scores"
print "and the Delta method using numerical partials"
print stdmuy~stdvy
print " "
if sump ne 1
print "Ergodic probabilities"
print " "
print pivec'
print " "
print "Standard errors based on conditional scores"
print " "
print pierr1
print " "
endif
endif
print "Modulus of the eigenvalues of the dynamic model"
print "(largest should be less than 1 for stationarity)"
print Amod
print " "
endif
print " Information Criteria"
print " AIC BIC LIL"
print " "
print infocrit
print " "
if qs >= 2
lms1 = "The LM test for "$+ ftocv(qs,1,0)$+ " independent"
print lms1
print "two-state regime variables"
print " "
print LM
print " "
print "with marginal level of significance"
lms2 = "(for "$+ ftocv(s11-s1,1,0)$+ " degrees of freedom)"
print lms2
print " "
print LMpv
print " "
print "The small sample corrected F-statistic"
print " "
print LMf
print " "
print "with marginal level of significance"
print " "
print LMfpv
print " "
endif
if rest >= 1 or sump == 1
if rest >= 1 and sump == 1
lmr1 = "The LM test of "$+ ftocv(rest,1,0)$+ " restrictions
on the VAR parameters and "$+ ftocv(s1*s1,1,0)$+ " rest-
restrictions on the Markov probabilities";
elseif rest >= 1 and sump ne 1
lmr1 = "The LM test of "$+ ftocv(rest,1,0)$+ " restrictions
on the VAR parameters";
elseif rest == 0 and sump == 1
lmr1 = "The LM test of a serially uncorrelated Markov
process ("$+ ftocv(s1*s1,1,0)$+ " restrictions on P)";
endif
print lmr1
print " "
print LMrest
print " "
print "with marginal level of significance"
print " "
print LMrestpv
print " "
print "The small sample corrected F-statistic"
print " "
print LMfres
print " "
print "with marginal level of significance"
print " "
print LMfrespv
print " "
endif
if rest == 0 and sump ne 1
print "Misspecification tests based on conditional scores"
print " "
if qs == 1
print " Equation-by-equation tests"
print " Equation Autocorr ARCH Markov"
print misspece
print " "
print " with p-values"
print pvspece
print " "
if n >= 2
print " System tests"
print " Autocorr ARCH Markov"
print " "
print misspec
print " "
print " with p-values"
print " "
print pvspec
print " "
endif
elseif qs >= 2
if n == 1
print " Equation-by-equation tests"
print " Equation Autocorr ARCH Markov"
print misspece
print " "
print " with p-values"
print pvspece
print " "
elseif n >= 2
print " Equation-by-equation tests"
print " Equation Autocorr ARCH"
print misspece
print " "
print " with p-values"
print pvspece
print " "
print " System tests"
print " Autocorr ARCH Markov"
print " "
print misspec
print " "
print " with p-values"
print " "
print pvspec
print " "
endif
endif
endif
endif
screen on
output off
format /MB1 /ROS 16,8
if m1 == 1 and it <= maxit
run C:\gauss10\Balcilar\msvar\programs\graphs.pgm
screen off
output on
format /M1 /ROS 10,6
run C:\gauss10\Balcilar\msvar\programs\regest.pgm
output off
screen on
endif
system
4 Answers
0
It appears that the problem is that many of the statements in this program do not end with semi-colons. In GAUSS, statements are separated by semi-colons. For example, towards the top of this program, we see:
if freq == 1 fsp = sp fep = ep ffobs = fobs else
Each of these lines should be separated by semi-colons, otherwise GAUSS interprets them as one long statement, like this:
if freq == 1 fsp = sp fep = ep ffobs = fobs else
The line above is not a valid GAUSS statement. To make it valid, GAUSS code, we need to add semi-colons to the end of the lines. Here is a fixed version of the first bit of the file.
new 2000,320000; /* Program version: May 31, 1999 */ run C:\gauss10\Balcilar\msvar\setup.mod; /* Fix data matrix and obs to match selected sample */ load data[434,2]=C:\gauss10\Balcilar\msvar\data\ymm5995.asc; if freq == 1; fsp = sp; fep = ep; ffobs = fobs; else; fsp = sp-(1/(2*freq)); fep = ep-(1/(2*freq)); ffobs = fobs-(1/(2*freq)); endif;
0
Dear Jason Many Thanks,
I added to the code the sem-clons but I have got another error message:
Line 83 in C:\gauss10\Balcilar\msvar.txt
Illegal redefinition of procedure G0156 : 'm'
Line 86 in C:\gauss10\Balcilar\msvar.txt
Illegal redefinition of procedure G0156 : 'm'
Line 89 in C:\gauss10\Balcilar\msvar.txt
Illegal redefinition of procedure G0156 : 'm'
Thanks a lot for your help
*******************************************************************************************
new 2000,320000
/* Program version: May 31, 1999 */
run C:\gauss10\Balcilar\msvar\setup.mod
/* Fix data matrix and obs to match selected sample */
load data[434,2]=C:\gauss10\Balcilar\msvar\data\ymm5995.asc;
if freq == 1;
fsp = sp;
fep = ep;
ffobs = fobs;
else;
fsp = sp-(1/(2*freq));
fep = ep-(1/(2*freq));
ffobs = fobs-(1/(2*freq));
endif;
startsp = round((((fsp-ffobs)*freq)+1));
endsp = round((((fep-ffobs)*freq)+1));
data = data[startsp:endsp,.];
obs = rows(data);
/* Prefilter seasonals from the data using dummies */
if preremov == 1;
run C:\gauss10\Balcilar\msvar\programs\searemov.pgm;
endif;
if m == 1 or m == 2 or m == 3 or m == 4 or m == 5;
m1 = 1;
m2 = 0;
k = q^2;
k1 = q;
k2 = 1;
elseif m == 6;
m1 = 1;
m2 = 0;
k = q^(p+1);
k1 = q^p;
k2 = q^(p-1);
elseif m == 7 or m == 8 or m == 9;
m1 = 1;
m2 = 1;
k = q^2;
k1 = q;
k2 = 1;
else;
m1 = 0;
m2 = 0;
endif;
if m1 == 0;
print " ";
print "You have NOT selected a model. Must be Q playing with your mind again!";
end;
endif;
if m2 == 0 and p == 0;
print " ";
print "You have forgotten to select lags. Must be all that Romulanale last night!";
end;
endif;
if dv == 0 and Sea ne 0;
print "You have selected dummy seasonals and NO deterministic variables(dv=0).Program NOT executed!";
end;
elseif dv == 0 and Trend ne 0;
print " ";
print "You have selected a linear deterministic trend and NO deterministic variables (dv=0).Program NOT executed!";
end;
endif;
if qs >= 2 and q ne 2^qs;
print " ";
print "Your specifications of q and qs are NOT compatible.Programs NOT executed!";
end;
endif;
if qs >= 2 and sump == 1;
print "You have selected sump=1 and qs>1. Option not available.Program NOT executed!";
end;
endif;
if m == 7;
mh = 7;
m = 1;
elseif m == 8;
mh = 8;
m = 2;
elseif m == 9;
mh = 9;
m = 5;
endif;
if Trend == 0 and Sea == 0;
trend1 = 1;
else;
trend1 = 0;
endif;
if trend1 == 1 and dv == 1;
print "You have selected deterministic variables (dv=1), but not specified a linear trend or seasonals.Program NOT executed!";
end;
endif;
/* Constructing data matrices */
T = obs-p;
if dv == 1 and sea == 0;
d = Trend;
elseif dv == 1 and sea == 4 or sea == 12;
d = Trend+sea-1;
else;
d = 0;
endif;
y = data[(p+1):obs,.]';
if p >= 1;
xmat = data[p:(obs-1),.]';
j = 2;
do while j <= p;
xmat = xmat|(data[(p+1-j):(obs-j),.]');
j = j+1;
endo;
endif;
conmat = ones(1,T);
/* Defining the variable dtrend */
if Trend == 1 and d >= 1;
dtrend = seqa(1,1,T)';
/* we read the data for conditioning variable */
dtrend = zmat;
d = cols(zmat);
endif;
/* Defining the centered seasonal dummies */
if sea == 4 and d >= 3;
seamat = zeros(3,T);
j = 1;
do while j <= 3;
i = j;
do while i <= T;
seamat[j,i] = 1;
i = i+4;
endo;
j = j+1;
endo;
adjsea = (1/4)*ones(3,T);
seamat = seamat - adjsea;
elseif sea == 12 and d>= 11;
seamat = zeros(11,T);
j = 1;
do while j <= 11;
i = j;
do while i <= T;
seamat[j,i] = 1;
i = i+12;
endo;
j = j+1;
endo;
adjsea = (1/12)*ones(11,T);
seamat = seamat - adjsea;
endif;
if Trend == 1 and sea == 4 or sea == 12;
dmat = dtrend|seamat;
elseif Trend == 0 and sea == 4 or sea == 12;
dmat = seamat;
elseif Trend == 1 and d == 1;
dmat = dtrend;
endif;
if d == 0 and p >= 1;
ymat = conmat|xmat;
elseif d == 0 and p == 0;
ymat = conmat;
elseif d >= 1 and p >= 1;
ymat = conmat|dmat|xmat;
else;
ymat = conmat|dmat;
endif;
if m >= 3 and m <= 4 and d >= 1;
xmat = dmat|xmat;
endif;
/* Setting up the n*n by n*(n+1)/2 Duplication matrix */
Dupn = zeros(n*n,n*(n+1)/2);
dnel2 = 0;
j = 1;
do while j <= n;
i = 1;
do while i <= n-j+1;
dnel2 = dnel2+1;
Dupn[i+(n+1)*(j-1),dnel2] = 1;
i = i+1;
endo;
j = j+1;
endo;
if n > 1;
j = 1;
do while j <= n-1;
dnstar = 1;
i = 1;
do while i <= j;
Dupn[i+n*j,dnstar+j-i+1] = 1;
dnstar = dnstar+n-i+1;
i = i+1;
endo;
j = j+1;
endo;
endif;
DMP = invpd(Dupn'*Dupn)*Dupn';
/* Setting up a selection matrix for mu(i) in model 6 */
if m == 6;
musel = eye(q) .*. ones(1,q^p);
j = 1;
do while j <= p;
muselj = ones(1,q^j) .*. (eye(q) .*. ones(1,q^(p-j)));
musel = musel|muselj;
j = j+1;
endo;
commute = zeros(q*(p+1),q*(p+1));
i = 1;
do while i <= p+1;
j = 1;
do while j <= q;
commute[j+q*(i-1),i+(p+1)*(j-1)] = 1;
j = j+1;
endo;
i = i+1;
endo;
musel = commute'*musel;
endif;
/* Starting the iterations */
if rest >= 1;
lambda = zeros(rest,1);
if m == 1;
selV = eye(n)~zeros(n,n*(q-1));
theta = vec(selV*A);
omega = DMP*vec(selV*V);
i = 2;
do while i <= q;
selVi = zeros(n,n*q);
j = 1;
do while j <= n;
selVi[j,j+n*(i-1)] = 1;
j = j+1;
endo;
theta = theta|(vec(selVi*A));
omega = omega|(DMP*vec(selVi*V));
i = i+1;
endo;
theta = theta|omega;
elseif m == 2;
selV = eye(n)~zeros(n,n*(q-1));
theta = vec(selV*A);
omega = DMP*vec(selV*V);
i = 2;
do while i <= q;
selAi = zeros(n,n*q);
j = 1;
do while j <= n;
selAi[j,j+n*(i-1)] = 1;
j = j+1;
endo;
theta = theta|(vec(selAi*A));
i = i+1;
endo;
theta = theta|omega;
elseif m == 3;
mu = A[.,1];
selAr = eye(n)~zeros(n,n*(q-1));
selAc = zeros(1,n*p+d)|eye(n*p+d);
Amat = selAr*A*selAc;
theta = mu|(vec(Amat));
i = 1;
do while i <= q;
selVi = zeros(n,n*q);
j = 1;
do while j <= n;
selVi[j,j+n*(i-1)] = 1;
j = j+1;
endo;
Vmati = selVi*V;
theta = theta|(DMP*vec(Vmati));
i = i+1;
endo;
elseif m == 4;
mu = A[.,1];
selAr = eye(n)~zeros(n,n*(q-1));
selAc = zeros(1,n*p+d)|eye(n*p+d);
Amat = selAr*A*selAc;
Vmat = selAr*V;
theta = mu|(vec(Amat))|(DMP*vec(Vmat));
elseif m == 5;
selV = eye(n)~zeros(n,n*(q-1));
theta = vec(selV*A);
omega = DMP*vec(selV*V);
i = 2;
do while i <= q;
selVi = zeros(n,n*q);
j = 1;
do while j <= n;
selVi[j,j+n*(i-1)] = 1;
j = j+1;
endo;
omega = omega|(DMP*vec(selVi*V));
i = i+1;
endo;
theta = theta|omega;
elseif m == 6;
mu = A[.,1];
selV = eye(n)~zeros(n,n*(q-1));
selAc = zeros(1,n*p+d)|eye(n*p+d);
Amat = selV*A*selAc;
Vmat = selV*V;
theta = mu|(vec(Amat))|(DMP*vec(Vmat));
endif;
fthetab = Rmat*theta-rvec;
restchek = maxc(abs(fthetab));
if restchek ne 0 and check == 1;
print " "
print "The initial parameter values you have selected do NOT meet the restrictions. Program NOT executed!";
end;
else;
Rort = null(Rmat);
endif;
endif;
Ainit = A;
Vinit = V;
Pinit = Pmat;
rho = (1/k)*ones(k,1);
lnL = 0;
dlnL = 0;
maxpar = 100;
maxgr = 100;
begini = sp;
endini = sp+((p-1)/freq);
begest = sp+(p/freq);
endest = ep;
begini1 = trunc(begini);
endini1 = trunc(endini);
begest1 = trunc(begest);
endest1 = trunc(endest);
if freq ne 1;
begini2 = begini+(1/(2*freq));
endini2 = endini+(1/(2*freq));
begest2 = begest+(1/(2*freq));
endest2 = endest+(1/(2*freq));
begini3 = round(((begini2-begini1)*freq));
endini3 = round(((endini2-endini1)*freq));
begest3 = round(((begest2-begest1)*freq));
endest3 = round(((endest2-endest1)*freq));
estsamp = "Estimation period: "$+ ftocv(begest1,2,0)$+ ":"$+ ftocv(begest3,1,0)$+ "-"$+ ftocv(endest1,2,0)$+ ":"$+ ftocv(endest3,1,0);
if p == 0;
inisamp = "Initial observations: None";
else;
inisamp = "Initial observations: "$+ ftocv(begini1,2,0)$+ ":"$+ ftocv(begini3,1,0)$+ "-"$+ ftocv(endini1,2,0)$+ ":"$+ ftocv(endini3,1,0);
endif;
else;
estsamp = "Estimation period: "$+ ftocv(begest1,2,0)$+ "-"$+ ftocv(endest1,2,0);
if p == 0;
inisamp = "Initial observations: None";
else;
inisamp = "Initial observations: "$+ ftocv(begini,2,0)$+ "-"$+ ftocv(endini,2,0);
endif;
endif;
mstr = "Variables for model "$+ ftocv(m,1,0)$+ ":";
estsamp1 = " "$+ estsamp;
inisamp1 = " "$+ inisamp;
numobs = "Number of observations: "$+ ftocv(T,2,0);
numobs1 = " "$+ numobs;
nstates1 = seqa(1,1,q);
if qs >= 2;
statesel = eye(2) .*. ones(1,2^(qs-1));
i = 1;
do while i <= qs-1;
statesi = ones(1,2^i) .*. (eye(2) .*. ones(1,2^(qs-1-i)));
statesel = statesel|statesi;
i = i+1;
endo;
comsel = zeros(2*qs,2*qs);
i = 1;
do while i <= qs;
j = 1;
do while j <= 2;
comsel[j+2*(i-1),i+qs*(j-1)] = 1;
j = j+1;
endo;
i = i+1;
endo;
statesel = comsel'*statesel;
statesej = reshape(statesel[.,1],2,qs)';
state1 = seqa(1,1,2);
states = statesej*state1;
j = 2;
do while j <= q;
statesej = reshape(statesel[.,j],2,qs)';
states = states~(statesej*state1);
j = j+1;
endo;
nstates1 = nstates1~(states');
endif;
if qs == 1;
ejstr = " State Est #obs";
elseif qs >= 2;
ejstr = " State Regime var's 1 to "$+ ftocv(qs,1,0)$+ " Est #obs";
endif;
headmsg = " ESTIMATING MS("$+ ftocv(q,1,0)$+ ")-VAR("$+ ftocv(p,1,0)$+ ") MODEL "$+ ftocv(m,1,0)$+ " FOR: "$+ mvars;
headund = " =";
headw = strlen(headmsg);
i = 9;
do while i <= headw;
headund = headund$+ "=";
i = i+1;
endo;
output off;
format /M1 /ROS 10,6;
cls;
locate csrlin,csrcol;
print ""
print headmsg;
print headund;
print " "
it = 1;
iterate: do while it<=maxit and maxpar>convcrit and maxgr>convcrit and m1==1;
run C:\gauss10\Balcilar\msvar\programs\smooth.pgm;
run C:\gauss10\Balcilar\msvar\programs\gradient.pgm;
if maxgr > convcrit;
run C:\gauss10\Balcilar\msvar\programs\estimate.pgm;
endif;
if it == 1;
values = " "$+ ftocv(it,1,0)$+ " "$+ ftocv(lnL,1,6)$+ " "$+ ftocv(dlnL,1,6)$+ " "$+ ftocv(maxpar,1,6)$+ " "$+ ftocv(maxgr,1,6);
elseif it < 10 and it > 1;
values1 = " "$+ ftocv(it,1,0)$+ " "$+ ftocv(lnL,1,6)$+ " "$+ ftocv(dlnL,1,6)$+ " "$+ ftocv(maxpar,1,6)$+ " "$+ ftocv(maxgr,1,6);
values = values$| values1;
elseif it < 100 and it > 9;
values1 = " "$+ ftocv(it,1,0)$+ " "$+ ftocv(lnL,1,6)$+ " "$+ ftocv(dlnL,1,6)$+ " "$+ ftocv(maxpar,1,6)$+ " "$+ ftocv(maxgr,1,6);
values = values$| values1;
else;
values1 = " "$+ ftocv(it,1,0)$+ " "$+ ftocv(lnL,1,6)$+ " "$+ ftocv(dlnL,1,6)$+ " "$+ ftocv(maxpar,1,6)$+ " "$+ ftocv(maxgr,1,6);
values = values$| values1;
endif;
nstates = nstates1~(piT*imathT);
nstates2 = " "$+ ftocv(nstates,1,0);
itmsg = " Iteration number: "$+ ftocv(it,1,0);
lnlmsg = " Current value of log Likelihood: "$+ ftocv(lnL,1,6);
mparmsg = " Maximum absolute parameter change: "$+ ftocv(maxpar,1,8);
mgrmsg = " Maximum absolute gradient element: "$+ ftocv(maxgr,1,8);
print itmsg;
print " "
print lnlmsg;
print mparmsg;
print mgrmsg;
if p >= 1;
karlmsg = " Largest system eigenvalue: "$+ ftocv(maxc(Amod),1,6);
karlmsg2 = " (Stationarity condition)";
print karlmsg;
print karlmsg2;
endif;
print " "
print estsamp1;
print inisamp1;
print numobs1;
print " ";
print ejstr;
print nstates2;
print " "
if p >= 1;
backline=csrlin-15-q;
else;
backline=csrlin-13-q;
endif;
locate backline,1;
it = it+1;
endo;
output on;
screen on;
print "A =" A;
print "V =" V;
if m1 == 1 and it <= maxit;
run C:\gauss10\Balcilar\msvar\programs\conscore.pgm;
run C:\gauss10\Balcilar\msvar\programs\standerr.pgm;
if rest == 0 and sump ne 1;
run C:\gauss10\Balcilar\msvar\programs\misspec.pgm;
endif;
infocrit = (2*((s-rest)-lnL))/T;
bic = (2*(((s-rest)*ln(T))-lnL))/T;
lil = (2*(((s-rest)*ln(ln(T)))-lnL))/T;
infocrit = infocrit~bic~lil;
endif;
output on;
screen off;
if m2 == 1;
m = mh;
endif;
if m1 == 1 and it > maxit;
screen on;
output off;
if p>=1;
forward=csrlin+15;
else;
forward=csrlin+13;
endif;
locate forward,1;
print ""
print ""
print " ***************************************************************";
print " ***************************************************************";
print " *** ***";
print " *** W A R N I N G ! W A R N I N G ! W A R N I N G ! ***";
print " *** ***";
print " ***************************************************************";
print " ***************************************************************"
print ""
print ""
print " **** ITERATIONS HAVE NOT CONVERGED ****";
print " "
print ""
print "If you would like to continue the iterations, please enter a new value for";
print "the maximum number of iterations (otherwise, select any integer and press"
print "enter)."
print ""
maxitnew = con(1,1);
maxitnew = trunc(maxitnew);
if maxitnew > maxit;
maxit = maxitnew;
cls;
locate csrlin,csrcol;
print ""
print headmsg;
print headund;
print " "
goto iterate;
else;
screen off;
output on;
endif;
/* Perhaps add some options */
endif;
if m1 == 1;
print iteration lnL difflnL maxpar diff maxgradient;
print values;
endif;
if m1 == 1 and it <= maxit;
print " "
print "********************************************************************"
print " "
print mstr;
print " "
print mvars;
print " "
print estsamp;
print inisamp;
print " "
print numobs;
print " "
print ejstr;
print nstates2;
print " "
if p >= 1;
if (maxc(Amod)) >= 1;
print "WARNING! The estimated parameters are not consistent with the 2nd order stationarity condition of Karlsen.";
print " "
endif;
if (maxc(Amod)) < 1 and d == 0;
run C:\gauss10\Balcilar\msvar\programs\meanvar.pgm;
run C:\gauss10\Balcilar\msvar\programs\mvstd.pgm;
endif;
endif;
print "Initial values of A";
print Ainit;
print " "
print "Initial values of V";
print Vinit;
print " "
print "Initial values of Pmat";
print Pinit;
print " "
print "These are the ML estimates of A";
print A;
print " "
print "Standard errors based on the conditional scores";
print Aerror1;
print " "
print "These are the ML estimates of V";
print V;
print " "
print "Standard errors based on the conditional scores";
print Verror1;
print " "
print "These are the ML estimates of the Markov probabilities";
if qs == 1;
print Pmat;
print " "
else;
print p0q;
print " "
endif;
print "Standard errors based on the conditional scores";
print Perror1;
print " "
if rest == 0 and p>=1;
print "Nyblom tests for parameter stability";
print " "
print " Markov .90 .95 .99";
print Np0;
print " "
print " mu .90 .95 .99";
print Nmu;
print " "
print " Res cov .90 .95 .99";
print Noma;
print " "
print "Nyblom tests for parameter stab in eq (rows) / state (cols)";
print Nyeqst;
print " "
if n*p+d+2 <= 20;
print " Critical values";
print " .90 .95 .99";
print Nyeqstcv;
print " "
endif;
endif;
if sump ne 1;
print "Wald test of serially uncorrelated Markov chain";
print " "
print Wald;
print " "
print "with marginal level of significance";
print " "
print Waldpv;
print " "
print "F-test of serially uncorrelated Markov chain";
print " "
print Waldf;
print " "
print "with marginal level of significance";
print " "
print Waldfpv;
print " "
endif;
if qs >= 2;
print "Wald and F-tests of no serial correlation for each independent Markov chain";
print " "
print "regime variable Wald F";
print (seqa(1,1,qs))~Wald1~Wald1f;
print " "
print "with marginal levels of significance";
print " "
print (seqa(1,1,qs))~Wald1pv~Wald1fpv;
print " "
endif;
if p >= 1;
if (maxc(Amod)) < 1 and d == 0;
print "First two moments conditional on s(t)";
print " Mean Covariance";
print dely~convy;
print " "
print "Standard errors based on conditional scores";
print "and the Delta method using numerical partials";
print stddely~seconvy;
print " "
print "First two moments";
print " Mean Covariance";
print muy~vy;
print " "
print "Standard errors based on conditional scores";
print "and the Delta method using numerical partials";
print stdmuy~stdvy;
print " "
if sump ne 1;
print "Ergodic probabilities";
print " "
print pivec';
print " "
print "Standard errors based on conditional scores";
print " "
print pierr1;
print " "
endif;
endif;
print "Modulus of the eigenvalues of the dynamic model";
print "(largest should be less than 1 for stationarity)";
print Amod;
print " "
endif;
print " Information Criteria";
print " AIC BIC LIL";
print " "
print infocrit;
print " "
if qs >= 2;
lms1 = "The LM test for "$+ ftocv(qs,1,0)$+ " independent";
print lms1;
print "two-state regime variables";
print " "
print LM;
print " "
print "with marginal level of significance";
lms2 = "(for "$+ ftocv(s11-s1,1,0)$+ " degrees of freedom)";
print lms2;
print " "
print LMpv;
print " "
print "The small sample corrected F-statistic";
print " "
print LMf;
print " "
print "with marginal level of significance";
print " "
print LMfpv;
print " "
endif;
if rest >= 1 or sump == 1;
if rest >= 1 and sump == 1;
lmr1 = "The LM test of "$+ ftocv(rest,1,0)$+ " restrictions on the VAR parameters and "$+ ftocv(s1*s1,1,0)$+ " rest-restrictions on the Markov probabilities";
elseif rest >= 1 and sump ne 1;
lmr1 = "The LM test of "$+ ftocv(rest,1,0)$+ " restrictions on the VAR parameters";
elseif rest == 0 and sump == 1;
lmr1 = "The LM test of a serially uncorrelated Markov process ("$+ ftocv(s1*s1,1,0)$+ " restrictions on P)";
endif;
print lmr1;
print " "
print LMrest;
print " "
print "with marginal level of significance";
print " "
print LMrestpv;
print " "
print "The small sample corrected F-statistic";
print " "
print LMfres;
print " "
print "with marginal level of significance";
print " "
print LMfrespv;
print " "
endif;
if rest == 0 and sump ne 1;
print "Misspecification tests based on conditional scores";
print " "
if qs == 1;
print " Equation-by-equation tests";
print " Equation Autocorr ARCH Markov";
print misspece;
print " "
print " with p-values";
print pvspece;
print " "
if n >= 2;
print " System tests";
print " Autocorr ARCH Markov";
print " "
print misspec;
print " "
print " with p-values";
print " "
print pvspec;
print " "
endif;
elseif qs >= 2;
if n == 1;
print " Equation-by-equation tests";
print " Equation Autocorr ARCH Markov";
print misspece;
print " "
print " with p-values";
print pvspece;
print " "
elseif n >= 2;
print " Equation-by-equation tests";
print " Equation Autocorr ARCH";
print misspece;
print " "
print " with p-values";
print pvspece;
print " "
print " System tests";
print " Autocorr ARCH Markov";
print " "
print misspec;
print " "
print " with p-values";
print " "
print pvspec;
print " "
endif;
endif;
endif;
endif;
screen on;
output off;
format /MB1 /ROS 16,8;
if m1 == 1 and it <= maxit;
run C:\gauss10\Balcilar\msvar\programs\graphs.pgm;
screen off;
output on;
format /M1 /ROS 10,6;
run C:\gauss10\Balcilar\msvar\programs\regest.pgm;
output off;
screen on;
endif;
system;
0
I think this problem is coming from the top of the file:
new 2000,320000 /* Program version: May 31, 1999 */ run C:\gauss10\Balcilar\msvar\setup.mod /* Fix data matrix and obs to match selected sample */ load data[434,2]=C:\gauss10\Balcilar\msvar\data\ymm5995.asc;
First off, semicolons are missing from the 'new' line and the 'run' line. The error Illegal redefinition of procedure G0156 : 'm' typically means that the variable (in this case m) is being used before it is assigned to. The variable, m is created when the file setup.mod is run.
I would recommend adding the semi-colons to the 'new' and 'run' line and then adding a simple diagnostic print statement after the 'run' line, like this:
//added semicolon below new 2000,320000; /* Program version: May 31, 1999 */ //added semicolon below run C:\gauss10\Balcilar\msvar\setup.mod; //added diagnostic print below print "m = " m; /* Fix data matrix and obs to match selected sample */ load data[434,2]=C:\gauss10\Balcilar\msvar\data\ymm5995.asc;
0
Thanks a lot! I corrected the errors but now I have got this error message:
Undefined symbols:
piT C:\gauss10\Balcilar\msvar\regime.src(475)
imathT C:\gauss10\Balcilar\msvar\regime.src(475)
Amod C:\gauss10\Balcilar\msvar\regime.src(488)
s C:\gauss10\Balcilar\msvar\regime.src(515)
Aerror1 C:\gauss10\Balcilar\msvar\regime.src(621)
Verror1 C:\gauss10\Balcilar\msvar\regime.src(627)
p0q C:\gauss10\Balcilar\msvar\regime.src(634)
Perror1 C:\gauss10\Balcilar\msvar\regime.src(638)
Np0 C:\gauss10\Balcilar\msvar\regime.src(644)
Nmu C:\gauss10\Balcilar\msvar\regime.src(647)
Noma C:\gauss10\Balcilar\msvar\regime.src(650)
Nyeqst C:\gauss10\Balcilar\msvar\regime.src(653)
Nyeqstcv C:\gauss10\Balcilar\msvar\regime.src(658)
Wald C:\gauss10\Balcilar\msvar\regime.src(665)
Waldpv C:\gauss10\Balcilar\msvar\regime.src(669)
Waldf C:\gauss10\Balcilar\msvar\regime.src(673)
Waldfpv C:\gauss10\Balcilar\msvar\regime.src(677)
Wald1 C:\gauss10\Balcilar\msvar\regime.src(685)
Wald1f C:\gauss10\Balcilar\msvar\regime.src(685)
Wald1pv C:\gauss10\Balcilar\msvar\regime.src(689)
Wald1fpv C:\gauss10\Balcilar\msvar\regime.src(689)
dely C:\gauss10\Balcilar\msvar\regime.src(696)
convy C:\gauss10\Balcilar\msvar\regime.src(696)
stddely C:\gauss10\Balcilar\msvar\regime.src(700)
seconvy C:\gauss10\Balcilar\msvar\regime.src(700)
muy C:\gauss10\Balcilar\msvar\regime.src(704)
vy C:\gauss10\Balcilar\msvar\regime.src(704)
stdmuy C:\gauss10\Balcilar\msvar\regime.src(708)
stdvy C:\gauss10\Balcilar\msvar\regime.src(708)
pivec C:\gauss10\Balcilar\msvar\regime.src(713)
pierr1 C:\gauss10\Balcilar\msvar\regime.src(717)
LM C:\gauss10\Balcilar\msvar\regime.src(736)
s11 C:\gauss10\Balcilar\msvar\regime.src(739)
s1 C:\gauss10\Balcilar\msvar\regime.src(739)
LMpv C:\gauss10\Balcilar\msvar\regime.src(742)
LMf C:\gauss10\Balcilar\msvar\regime.src(746)
LMfpv C:\gauss10\Balcilar\msvar\regime.src(750)
LMrest C:\gauss10\Balcilar\msvar\regime.src(767)
LMrestpv C:\gauss10\Balcilar\msvar\regime.src(771)
LMfres C:\gauss10\Balcilar\msvar\regime.src(775)
LMfrespv C:\gauss10\Balcilar\msvar\regime.src(779)
misspece C:\gauss10\Balcilar\msvar\regime.src(788)
pvspece C:\gauss10\Balcilar\msvar\regime.src(791)
misspec C:\gauss10\Balcilar\msvar\regime.src(797)
pvspec C:\gauss10\Balcilar\msvar\regime.src(801)
Many thanks,
N.K
Your Answer
4 Answers
It appears that the problem is that many of the statements in this program do not end with semi-colons. In GAUSS, statements are separated by semi-colons. For example, towards the top of this program, we see:
if freq == 1 fsp = sp fep = ep ffobs = fobs else
Each of these lines should be separated by semi-colons, otherwise GAUSS interprets them as one long statement, like this:
if freq == 1 fsp = sp fep = ep ffobs = fobs else
The line above is not a valid GAUSS statement. To make it valid, GAUSS code, we need to add semi-colons to the end of the lines. Here is a fixed version of the first bit of the file.
new 2000,320000; /* Program version: May 31, 1999 */ run C:\gauss10\Balcilar\msvar\setup.mod; /* Fix data matrix and obs to match selected sample */ load data[434,2]=C:\gauss10\Balcilar\msvar\data\ymm5995.asc; if freq == 1; fsp = sp; fep = ep; ffobs = fobs; else; fsp = sp-(1/(2*freq)); fep = ep-(1/(2*freq)); ffobs = fobs-(1/(2*freq)); endif;
Dear Jason Many Thanks,
I added to the code the sem-clons but I have got another error message:
Line 83 in C:\gauss10\Balcilar\msvar.txt
Illegal redefinition of procedure G0156 : 'm'
Line 86 in C:\gauss10\Balcilar\msvar.txt
Illegal redefinition of procedure G0156 : 'm'
Line 89 in C:\gauss10\Balcilar\msvar.txt
Illegal redefinition of procedure G0156 : 'm'
Thanks a lot for your help
*******************************************************************************************
new 2000,320000
/* Program version: May 31, 1999 */
run C:\gauss10\Balcilar\msvar\setup.mod
/* Fix data matrix and obs to match selected sample */
load data[434,2]=C:\gauss10\Balcilar\msvar\data\ymm5995.asc;
if freq == 1;
fsp = sp;
fep = ep;
ffobs = fobs;
else;
fsp = sp-(1/(2*freq));
fep = ep-(1/(2*freq));
ffobs = fobs-(1/(2*freq));
endif;
startsp = round((((fsp-ffobs)*freq)+1));
endsp = round((((fep-ffobs)*freq)+1));
data = data[startsp:endsp,.];
obs = rows(data);
/* Prefilter seasonals from the data using dummies */
if preremov == 1;
run C:\gauss10\Balcilar\msvar\programs\searemov.pgm;
endif;
if m == 1 or m == 2 or m == 3 or m == 4 or m == 5;
m1 = 1;
m2 = 0;
k = q^2;
k1 = q;
k2 = 1;
elseif m == 6;
m1 = 1;
m2 = 0;
k = q^(p+1);
k1 = q^p;
k2 = q^(p-1);
elseif m == 7 or m == 8 or m == 9;
m1 = 1;
m2 = 1;
k = q^2;
k1 = q;
k2 = 1;
else;
m1 = 0;
m2 = 0;
endif;
if m1 == 0;
print " ";
print "You have NOT selected a model. Must be Q playing with your mind again!";
end;
endif;
if m2 == 0 and p == 0;
print " ";
print "You have forgotten to select lags. Must be all that Romulanale last night!";
end;
endif;
if dv == 0 and Sea ne 0;
print "You have selected dummy seasonals and NO deterministic variables(dv=0).Program NOT executed!";
end;
elseif dv == 0 and Trend ne 0;
print " ";
print "You have selected a linear deterministic trend and NO deterministic variables (dv=0).Program NOT executed!";
end;
endif;
if qs >= 2 and q ne 2^qs;
print " ";
print "Your specifications of q and qs are NOT compatible.Programs NOT executed!";
end;
endif;
if qs >= 2 and sump == 1;
print "You have selected sump=1 and qs>1. Option not available.Program NOT executed!";
end;
endif;
if m == 7;
mh = 7;
m = 1;
elseif m == 8;
mh = 8;
m = 2;
elseif m == 9;
mh = 9;
m = 5;
endif;
if Trend == 0 and Sea == 0;
trend1 = 1;
else;
trend1 = 0;
endif;
if trend1 == 1 and dv == 1;
print "You have selected deterministic variables (dv=1), but not specified a linear trend or seasonals.Program NOT executed!";
end;
endif;
/* Constructing data matrices */
T = obs-p;
if dv == 1 and sea == 0;
d = Trend;
elseif dv == 1 and sea == 4 or sea == 12;
d = Trend+sea-1;
else;
d = 0;
endif;
y = data[(p+1):obs,.]';
if p >= 1;
xmat = data[p:(obs-1),.]';
j = 2;
do while j <= p;
xmat = xmat|(data[(p+1-j):(obs-j),.]');
j = j+1;
endo;
endif;
conmat = ones(1,T);
/* Defining the variable dtrend */
if Trend == 1 and d >= 1;
dtrend = seqa(1,1,T)';
/* we read the data for conditioning variable */
dtrend = zmat;
d = cols(zmat);
endif;
/* Defining the centered seasonal dummies */
if sea == 4 and d >= 3;
seamat = zeros(3,T);
j = 1;
do while j <= 3;
i = j;
do while i <= T;
seamat[j,i] = 1;
i = i+4;
endo;
j = j+1;
endo;
adjsea = (1/4)*ones(3,T);
seamat = seamat - adjsea;
elseif sea == 12 and d>= 11;
seamat = zeros(11,T);
j = 1;
do while j <= 11;
i = j;
do while i <= T;
seamat[j,i] = 1;
i = i+12;
endo;
j = j+1;
endo;
adjsea = (1/12)*ones(11,T);
seamat = seamat - adjsea;
endif;
if Trend == 1 and sea == 4 or sea == 12;
dmat = dtrend|seamat;
elseif Trend == 0 and sea == 4 or sea == 12;
dmat = seamat;
elseif Trend == 1 and d == 1;
dmat = dtrend;
endif;
if d == 0 and p >= 1;
ymat = conmat|xmat;
elseif d == 0 and p == 0;
ymat = conmat;
elseif d >= 1 and p >= 1;
ymat = conmat|dmat|xmat;
else;
ymat = conmat|dmat;
endif;
if m >= 3 and m <= 4 and d >= 1;
xmat = dmat|xmat;
endif;
/* Setting up the n*n by n*(n+1)/2 Duplication matrix */
Dupn = zeros(n*n,n*(n+1)/2);
dnel2 = 0;
j = 1;
do while j <= n;
i = 1;
do while i <= n-j+1;
dnel2 = dnel2+1;
Dupn[i+(n+1)*(j-1),dnel2] = 1;
i = i+1;
endo;
j = j+1;
endo;
if n > 1;
j = 1;
do while j <= n-1;
dnstar = 1;
i = 1;
do while i <= j;
Dupn[i+n*j,dnstar+j-i+1] = 1;
dnstar = dnstar+n-i+1;
i = i+1;
endo;
j = j+1;
endo;
endif;
DMP = invpd(Dupn'*Dupn)*Dupn';
/* Setting up a selection matrix for mu(i) in model 6 */
if m == 6;
musel = eye(q) .*. ones(1,q^p);
j = 1;
do while j <= p;
muselj = ones(1,q^j) .*. (eye(q) .*. ones(1,q^(p-j)));
musel = musel|muselj;
j = j+1;
endo;
commute = zeros(q*(p+1),q*(p+1));
i = 1;
do while i <= p+1;
j = 1;
do while j <= q;
commute[j+q*(i-1),i+(p+1)*(j-1)] = 1;
j = j+1;
endo;
i = i+1;
endo;
musel = commute'*musel;
endif;
/* Starting the iterations */
if rest >= 1;
lambda = zeros(rest,1);
if m == 1;
selV = eye(n)~zeros(n,n*(q-1));
theta = vec(selV*A);
omega = DMP*vec(selV*V);
i = 2;
do while i <= q;
selVi = zeros(n,n*q);
j = 1;
do while j <= n;
selVi[j,j+n*(i-1)] = 1;
j = j+1;
endo;
theta = theta|(vec(selVi*A));
omega = omega|(DMP*vec(selVi*V));
i = i+1;
endo;
theta = theta|omega;
elseif m == 2;
selV = eye(n)~zeros(n,n*(q-1));
theta = vec(selV*A);
omega = DMP*vec(selV*V);
i = 2;
do while i <= q;
selAi = zeros(n,n*q);
j = 1;
do while j <= n;
selAi[j,j+n*(i-1)] = 1;
j = j+1;
endo;
theta = theta|(vec(selAi*A));
i = i+1;
endo;
theta = theta|omega;
elseif m == 3;
mu = A[.,1];
selAr = eye(n)~zeros(n,n*(q-1));
selAc = zeros(1,n*p+d)|eye(n*p+d);
Amat = selAr*A*selAc;
theta = mu|(vec(Amat));
i = 1;
do while i <= q;
selVi = zeros(n,n*q);
j = 1;
do while j <= n;
selVi[j,j+n*(i-1)] = 1;
j = j+1;
endo;
Vmati = selVi*V;
theta = theta|(DMP*vec(Vmati));
i = i+1;
endo;
elseif m == 4;
mu = A[.,1];
selAr = eye(n)~zeros(n,n*(q-1));
selAc = zeros(1,n*p+d)|eye(n*p+d);
Amat = selAr*A*selAc;
Vmat = selAr*V;
theta = mu|(vec(Amat))|(DMP*vec(Vmat));
elseif m == 5;
selV = eye(n)~zeros(n,n*(q-1));
theta = vec(selV*A);
omega = DMP*vec(selV*V);
i = 2;
do while i <= q;
selVi = zeros(n,n*q);
j = 1;
do while j <= n;
selVi[j,j+n*(i-1)] = 1;
j = j+1;
endo;
omega = omega|(DMP*vec(selVi*V));
i = i+1;
endo;
theta = theta|omega;
elseif m == 6;
mu = A[.,1];
selV = eye(n)~zeros(n,n*(q-1));
selAc = zeros(1,n*p+d)|eye(n*p+d);
Amat = selV*A*selAc;
Vmat = selV*V;
theta = mu|(vec(Amat))|(DMP*vec(Vmat));
endif;
fthetab = Rmat*theta-rvec;
restchek = maxc(abs(fthetab));
if restchek ne 0 and check == 1;
print " "
print "The initial parameter values you have selected do NOT meet the restrictions. Program NOT executed!";
end;
else;
Rort = null(Rmat);
endif;
endif;
Ainit = A;
Vinit = V;
Pinit = Pmat;
rho = (1/k)*ones(k,1);
lnL = 0;
dlnL = 0;
maxpar = 100;
maxgr = 100;
begini = sp;
endini = sp+((p-1)/freq);
begest = sp+(p/freq);
endest = ep;
begini1 = trunc(begini);
endini1 = trunc(endini);
begest1 = trunc(begest);
endest1 = trunc(endest);
if freq ne 1;
begini2 = begini+(1/(2*freq));
endini2 = endini+(1/(2*freq));
begest2 = begest+(1/(2*freq));
endest2 = endest+(1/(2*freq));
begini3 = round(((begini2-begini1)*freq));
endini3 = round(((endini2-endini1)*freq));
begest3 = round(((begest2-begest1)*freq));
endest3 = round(((endest2-endest1)*freq));
estsamp = "Estimation period: "$+ ftocv(begest1,2,0)$+ ":"$+ ftocv(begest3,1,0)$+ "-"$+ ftocv(endest1,2,0)$+ ":"$+ ftocv(endest3,1,0);
if p == 0;
inisamp = "Initial observations: None";
else;
inisamp = "Initial observations: "$+ ftocv(begini1,2,0)$+ ":"$+ ftocv(begini3,1,0)$+ "-"$+ ftocv(endini1,2,0)$+ ":"$+ ftocv(endini3,1,0);
endif;
else;
estsamp = "Estimation period: "$+ ftocv(begest1,2,0)$+ "-"$+ ftocv(endest1,2,0);
if p == 0;
inisamp = "Initial observations: None";
else;
inisamp = "Initial observations: "$+ ftocv(begini,2,0)$+ "-"$+ ftocv(endini,2,0);
endif;
endif;
mstr = "Variables for model "$+ ftocv(m,1,0)$+ ":";
estsamp1 = " "$+ estsamp;
inisamp1 = " "$+ inisamp;
numobs = "Number of observations: "$+ ftocv(T,2,0);
numobs1 = " "$+ numobs;
nstates1 = seqa(1,1,q);
if qs >= 2;
statesel = eye(2) .*. ones(1,2^(qs-1));
i = 1;
do while i <= qs-1;
statesi = ones(1,2^i) .*. (eye(2) .*. ones(1,2^(qs-1-i)));
statesel = statesel|statesi;
i = i+1;
endo;
comsel = zeros(2*qs,2*qs);
i = 1;
do while i <= qs;
j = 1;
do while j <= 2;
comsel[j+2*(i-1),i+qs*(j-1)] = 1;
j = j+1;
endo;
i = i+1;
endo;
statesel = comsel'*statesel;
statesej = reshape(statesel[.,1],2,qs)';
state1 = seqa(1,1,2);
states = statesej*state1;
j = 2;
do while j <= q;
statesej = reshape(statesel[.,j],2,qs)';
states = states~(statesej*state1);
j = j+1;
endo;
nstates1 = nstates1~(states');
endif;
if qs == 1;
ejstr = " State Est #obs";
elseif qs >= 2;
ejstr = " State Regime var's 1 to "$+ ftocv(qs,1,0)$+ " Est #obs";
endif;
headmsg = " ESTIMATING MS("$+ ftocv(q,1,0)$+ ")-VAR("$+ ftocv(p,1,0)$+ ") MODEL "$+ ftocv(m,1,0)$+ " FOR: "$+ mvars;
headund = " =";
headw = strlen(headmsg);
i = 9;
do while i <= headw;
headund = headund$+ "=";
i = i+1;
endo;
output off;
format /M1 /ROS 10,6;
cls;
locate csrlin,csrcol;
print ""
print headmsg;
print headund;
print " "
it = 1;
iterate: do while it<=maxit and maxpar>convcrit and maxgr>convcrit and m1==1;
run C:\gauss10\Balcilar\msvar\programs\smooth.pgm;
run C:\gauss10\Balcilar\msvar\programs\gradient.pgm;
if maxgr > convcrit;
run C:\gauss10\Balcilar\msvar\programs\estimate.pgm;
endif;
if it == 1;
values = " "$+ ftocv(it,1,0)$+ " "$+ ftocv(lnL,1,6)$+ " "$+ ftocv(dlnL,1,6)$+ " "$+ ftocv(maxpar,1,6)$+ " "$+ ftocv(maxgr,1,6);
elseif it < 10 and it > 1;
values1 = " "$+ ftocv(it,1,0)$+ " "$+ ftocv(lnL,1,6)$+ " "$+ ftocv(dlnL,1,6)$+ " "$+ ftocv(maxpar,1,6)$+ " "$+ ftocv(maxgr,1,6);
values = values$| values1;
elseif it < 100 and it > 9;
values1 = " "$+ ftocv(it,1,0)$+ " "$+ ftocv(lnL,1,6)$+ " "$+ ftocv(dlnL,1,6)$+ " "$+ ftocv(maxpar,1,6)$+ " "$+ ftocv(maxgr,1,6);
values = values$| values1;
else;
values1 = " "$+ ftocv(it,1,0)$+ " "$+ ftocv(lnL,1,6)$+ " "$+ ftocv(dlnL,1,6)$+ " "$+ ftocv(maxpar,1,6)$+ " "$+ ftocv(maxgr,1,6);
values = values$| values1;
endif;
nstates = nstates1~(piT*imathT);
nstates2 = " "$+ ftocv(nstates,1,0);
itmsg = " Iteration number: "$+ ftocv(it,1,0);
lnlmsg = " Current value of log Likelihood: "$+ ftocv(lnL,1,6);
mparmsg = " Maximum absolute parameter change: "$+ ftocv(maxpar,1,8);
mgrmsg = " Maximum absolute gradient element: "$+ ftocv(maxgr,1,8);
print itmsg;
print " "
print lnlmsg;
print mparmsg;
print mgrmsg;
if p >= 1;
karlmsg = " Largest system eigenvalue: "$+ ftocv(maxc(Amod),1,6);
karlmsg2 = " (Stationarity condition)";
print karlmsg;
print karlmsg2;
endif;
print " "
print estsamp1;
print inisamp1;
print numobs1;
print " ";
print ejstr;
print nstates2;
print " "
if p >= 1;
backline=csrlin-15-q;
else;
backline=csrlin-13-q;
endif;
locate backline,1;
it = it+1;
endo;
output on;
screen on;
print "A =" A;
print "V =" V;
if m1 == 1 and it <= maxit;
run C:\gauss10\Balcilar\msvar\programs\conscore.pgm;
run C:\gauss10\Balcilar\msvar\programs\standerr.pgm;
if rest == 0 and sump ne 1;
run C:\gauss10\Balcilar\msvar\programs\misspec.pgm;
endif;
infocrit = (2*((s-rest)-lnL))/T;
bic = (2*(((s-rest)*ln(T))-lnL))/T;
lil = (2*(((s-rest)*ln(ln(T)))-lnL))/T;
infocrit = infocrit~bic~lil;
endif;
output on;
screen off;
if m2 == 1;
m = mh;
endif;
if m1 == 1 and it > maxit;
screen on;
output off;
if p>=1;
forward=csrlin+15;
else;
forward=csrlin+13;
endif;
locate forward,1;
print ""
print ""
print " ***************************************************************";
print " ***************************************************************";
print " *** ***";
print " *** W A R N I N G ! W A R N I N G ! W A R N I N G ! ***";
print " *** ***";
print " ***************************************************************";
print " ***************************************************************"
print ""
print ""
print " **** ITERATIONS HAVE NOT CONVERGED ****";
print " "
print ""
print "If you would like to continue the iterations, please enter a new value for";
print "the maximum number of iterations (otherwise, select any integer and press"
print "enter)."
print ""
maxitnew = con(1,1);
maxitnew = trunc(maxitnew);
if maxitnew > maxit;
maxit = maxitnew;
cls;
locate csrlin,csrcol;
print ""
print headmsg;
print headund;
print " "
goto iterate;
else;
screen off;
output on;
endif;
/* Perhaps add some options */
endif;
if m1 == 1;
print iteration lnL difflnL maxpar diff maxgradient;
print values;
endif;
if m1 == 1 and it <= maxit;
print " "
print "********************************************************************"
print " "
print mstr;
print " "
print mvars;
print " "
print estsamp;
print inisamp;
print " "
print numobs;
print " "
print ejstr;
print nstates2;
print " "
if p >= 1;
if (maxc(Amod)) >= 1;
print "WARNING! The estimated parameters are not consistent with the 2nd order stationarity condition of Karlsen.";
print " "
endif;
if (maxc(Amod)) < 1 and d == 0;
run C:\gauss10\Balcilar\msvar\programs\meanvar.pgm;
run C:\gauss10\Balcilar\msvar\programs\mvstd.pgm;
endif;
endif;
print "Initial values of A";
print Ainit;
print " "
print "Initial values of V";
print Vinit;
print " "
print "Initial values of Pmat";
print Pinit;
print " "
print "These are the ML estimates of A";
print A;
print " "
print "Standard errors based on the conditional scores";
print Aerror1;
print " "
print "These are the ML estimates of V";
print V;
print " "
print "Standard errors based on the conditional scores";
print Verror1;
print " "
print "These are the ML estimates of the Markov probabilities";
if qs == 1;
print Pmat;
print " "
else;
print p0q;
print " "
endif;
print "Standard errors based on the conditional scores";
print Perror1;
print " "
if rest == 0 and p>=1;
print "Nyblom tests for parameter stability";
print " "
print " Markov .90 .95 .99";
print Np0;
print " "
print " mu .90 .95 .99";
print Nmu;
print " "
print " Res cov .90 .95 .99";
print Noma;
print " "
print "Nyblom tests for parameter stab in eq (rows) / state (cols)";
print Nyeqst;
print " "
if n*p+d+2 <= 20;
print " Critical values";
print " .90 .95 .99";
print Nyeqstcv;
print " "
endif;
endif;
if sump ne 1;
print "Wald test of serially uncorrelated Markov chain";
print " "
print Wald;
print " "
print "with marginal level of significance";
print " "
print Waldpv;
print " "
print "F-test of serially uncorrelated Markov chain";
print " "
print Waldf;
print " "
print "with marginal level of significance";
print " "
print Waldfpv;
print " "
endif;
if qs >= 2;
print "Wald and F-tests of no serial correlation for each independent Markov chain";
print " "
print "regime variable Wald F";
print (seqa(1,1,qs))~Wald1~Wald1f;
print " "
print "with marginal levels of significance";
print " "
print (seqa(1,1,qs))~Wald1pv~Wald1fpv;
print " "
endif;
if p >= 1;
if (maxc(Amod)) < 1 and d == 0;
print "First two moments conditional on s(t)";
print " Mean Covariance";
print dely~convy;
print " "
print "Standard errors based on conditional scores";
print "and the Delta method using numerical partials";
print stddely~seconvy;
print " "
print "First two moments";
print " Mean Covariance";
print muy~vy;
print " "
print "Standard errors based on conditional scores";
print "and the Delta method using numerical partials";
print stdmuy~stdvy;
print " "
if sump ne 1;
print "Ergodic probabilities";
print " "
print pivec';
print " "
print "Standard errors based on conditional scores";
print " "
print pierr1;
print " "
endif;
endif;
print "Modulus of the eigenvalues of the dynamic model";
print "(largest should be less than 1 for stationarity)";
print Amod;
print " "
endif;
print " Information Criteria";
print " AIC BIC LIL";
print " "
print infocrit;
print " "
if qs >= 2;
lms1 = "The LM test for "$+ ftocv(qs,1,0)$+ " independent";
print lms1;
print "two-state regime variables";
print " "
print LM;
print " "
print "with marginal level of significance";
lms2 = "(for "$+ ftocv(s11-s1,1,0)$+ " degrees of freedom)";
print lms2;
print " "
print LMpv;
print " "
print "The small sample corrected F-statistic";
print " "
print LMf;
print " "
print "with marginal level of significance";
print " "
print LMfpv;
print " "
endif;
if rest >= 1 or sump == 1;
if rest >= 1 and sump == 1;
lmr1 = "The LM test of "$+ ftocv(rest,1,0)$+ " restrictions on the VAR parameters and "$+ ftocv(s1*s1,1,0)$+ " rest-restrictions on the Markov probabilities";
elseif rest >= 1 and sump ne 1;
lmr1 = "The LM test of "$+ ftocv(rest,1,0)$+ " restrictions on the VAR parameters";
elseif rest == 0 and sump == 1;
lmr1 = "The LM test of a serially uncorrelated Markov process ("$+ ftocv(s1*s1,1,0)$+ " restrictions on P)";
endif;
print lmr1;
print " "
print LMrest;
print " "
print "with marginal level of significance";
print " "
print LMrestpv;
print " "
print "The small sample corrected F-statistic";
print " "
print LMfres;
print " "
print "with marginal level of significance";
print " "
print LMfrespv;
print " "
endif;
if rest == 0 and sump ne 1;
print "Misspecification tests based on conditional scores";
print " "
if qs == 1;
print " Equation-by-equation tests";
print " Equation Autocorr ARCH Markov";
print misspece;
print " "
print " with p-values";
print pvspece;
print " "
if n >= 2;
print " System tests";
print " Autocorr ARCH Markov";
print " "
print misspec;
print " "
print " with p-values";
print " "
print pvspec;
print " "
endif;
elseif qs >= 2;
if n == 1;
print " Equation-by-equation tests";
print " Equation Autocorr ARCH Markov";
print misspece;
print " "
print " with p-values";
print pvspece;
print " "
elseif n >= 2;
print " Equation-by-equation tests";
print " Equation Autocorr ARCH";
print misspece;
print " "
print " with p-values";
print pvspece;
print " "
print " System tests";
print " Autocorr ARCH Markov";
print " "
print misspec;
print " "
print " with p-values";
print " "
print pvspec;
print " "
endif;
endif;
endif;
endif;
screen on;
output off;
format /MB1 /ROS 16,8;
if m1 == 1 and it <= maxit;
run C:\gauss10\Balcilar\msvar\programs\graphs.pgm;
screen off;
output on;
format /M1 /ROS 10,6;
run C:\gauss10\Balcilar\msvar\programs\regest.pgm;
output off;
screen on;
endif;
system;
I think this problem is coming from the top of the file:
new 2000,320000 /* Program version: May 31, 1999 */ run C:\gauss10\Balcilar\msvar\setup.mod /* Fix data matrix and obs to match selected sample */ load data[434,2]=C:\gauss10\Balcilar\msvar\data\ymm5995.asc;
First off, semicolons are missing from the 'new' line and the 'run' line. The error Illegal redefinition of procedure G0156 : 'm' typically means that the variable (in this case m) is being used before it is assigned to. The variable, m is created when the file setup.mod is run.
I would recommend adding the semi-colons to the 'new' and 'run' line and then adding a simple diagnostic print statement after the 'run' line, like this:
//added semicolon below new 2000,320000; /* Program version: May 31, 1999 */ //added semicolon below run C:\gauss10\Balcilar\msvar\setup.mod; //added diagnostic print below print "m = " m; /* Fix data matrix and obs to match selected sample */ load data[434,2]=C:\gauss10\Balcilar\msvar\data\ymm5995.asc;
Thanks a lot! I corrected the errors but now I have got this error message:
Undefined symbols:
piT C:\gauss10\Balcilar\msvar\regime.src(475)
imathT C:\gauss10\Balcilar\msvar\regime.src(475)
Amod C:\gauss10\Balcilar\msvar\regime.src(488)
s C:\gauss10\Balcilar\msvar\regime.src(515)
Aerror1 C:\gauss10\Balcilar\msvar\regime.src(621)
Verror1 C:\gauss10\Balcilar\msvar\regime.src(627)
p0q C:\gauss10\Balcilar\msvar\regime.src(634)
Perror1 C:\gauss10\Balcilar\msvar\regime.src(638)
Np0 C:\gauss10\Balcilar\msvar\regime.src(644)
Nmu C:\gauss10\Balcilar\msvar\regime.src(647)
Noma C:\gauss10\Balcilar\msvar\regime.src(650)
Nyeqst C:\gauss10\Balcilar\msvar\regime.src(653)
Nyeqstcv C:\gauss10\Balcilar\msvar\regime.src(658)
Wald C:\gauss10\Balcilar\msvar\regime.src(665)
Waldpv C:\gauss10\Balcilar\msvar\regime.src(669)
Waldf C:\gauss10\Balcilar\msvar\regime.src(673)
Waldfpv C:\gauss10\Balcilar\msvar\regime.src(677)
Wald1 C:\gauss10\Balcilar\msvar\regime.src(685)
Wald1f C:\gauss10\Balcilar\msvar\regime.src(685)
Wald1pv C:\gauss10\Balcilar\msvar\regime.src(689)
Wald1fpv C:\gauss10\Balcilar\msvar\regime.src(689)
dely C:\gauss10\Balcilar\msvar\regime.src(696)
convy C:\gauss10\Balcilar\msvar\regime.src(696)
stddely C:\gauss10\Balcilar\msvar\regime.src(700)
seconvy C:\gauss10\Balcilar\msvar\regime.src(700)
muy C:\gauss10\Balcilar\msvar\regime.src(704)
vy C:\gauss10\Balcilar\msvar\regime.src(704)
stdmuy C:\gauss10\Balcilar\msvar\regime.src(708)
stdvy C:\gauss10\Balcilar\msvar\regime.src(708)
pivec C:\gauss10\Balcilar\msvar\regime.src(713)
pierr1 C:\gauss10\Balcilar\msvar\regime.src(717)
LM C:\gauss10\Balcilar\msvar\regime.src(736)
s11 C:\gauss10\Balcilar\msvar\regime.src(739)
s1 C:\gauss10\Balcilar\msvar\regime.src(739)
LMpv C:\gauss10\Balcilar\msvar\regime.src(742)
LMf C:\gauss10\Balcilar\msvar\regime.src(746)
LMfpv C:\gauss10\Balcilar\msvar\regime.src(750)
LMrest C:\gauss10\Balcilar\msvar\regime.src(767)
LMrestpv C:\gauss10\Balcilar\msvar\regime.src(771)
LMfres C:\gauss10\Balcilar\msvar\regime.src(775)
LMfrespv C:\gauss10\Balcilar\msvar\regime.src(779)
misspece C:\gauss10\Balcilar\msvar\regime.src(788)
pvspece C:\gauss10\Balcilar\msvar\regime.src(791)
misspec C:\gauss10\Balcilar\msvar\regime.src(797)
pvspec C:\gauss10\Balcilar\msvar\regime.src(801)
Many thanks,
N.K