illegal or reserved name
Posted: Sun Feb 05, 2017 4:45 pm
Hello altogether,
the following code leads to "illegal or reserved name" regarding makesignals and makestates. Why?
Hint: makesignals and makestates are on the bottom of the code
Many thanks for your help
wfcreate(wf=uoc, page=uoc) d(1,5) 7/1/2009 1/12/2016
!obstotal = @obssmpl
' counts the number of observations in the sample
!varnr = 5
' counts the number of variables in the model
!paramnumber = 2
'counts the number of parameters of the state space model considered
matrix(!obstotal,!varnr) datamat
' generates a matrix for the data
datamat.read(b2,s=Tabelle1) "E:\Dissertation\Daten Dissertation\Daten endgültig.xls"
' reads the data from the excel sheet into the data matrix
series cds_spread
series aktienkurs
series historische_volatilitaet
series implizite_volatilitaet
series risikoloser_zinssatz
' generates a series for the variable
group variables cds_spread aktienkurs historische_volatilitaet implizite_volatilitaet risikoloser_zinssatz
mtos(datamat,variables)
' converts the data matrix to the series defined above
' generate state space model and save loglikelihood:
sspace solution
!loglik=-1000000
table results
results(1,1)="LogLik"
results(1,2)="Result"
results(1,3)="AIC"
results(1,4)="Schwarz"
results(1,5)="Hannan-Quinn"
!row=1
for !i=1 to 10 step 1
smpl @all
series start = (-1+2*rnd)
for !j=1 to !paramnumber step 1
!startvar=start(!j)
param c(!j) !startvar
next
smpl 7/1/2009 1/12/2016
sspace uoc
uoc.append @ename e1
uoc.append @ename e2
uoc.append @ename e3
uoc.append @ename e4
uoc.append @ename e5
uoc.append @ename e6
uoc.append @evar var(e1) = exp(c(1))
uoc.append @evar var(e2) = exp(c(2))
uoc.append @evar var(e3) = exp(c(3))
uoc.append @evar var(e4) = exp(c(4))
uoc.append @evar var(e5) = exp(c(5))
uoc.append @evar var(e6) = exp(c(6))
uoc.append @state sv1=sv1(-1)+ e2
'uoc.append @state sv3=sv2(-1)
'uoc.append @state sv4=sv4(-1)
'uoc.append @state sv5=sv5(-1)
'uoc.append @state sv6=sv6(-1)
' uoc.append @state sv2=sv2(-1)
' uoc.append @state sv3=sv3(-1) + e4
' uoc.append @state sv4=sv4(-1)
' uoc.append @state sv5=sv5(-1) + e6
uoc.append @signal cds_spread=sv1 +e1
uoc.ml(m=1000,c=1e-6)
freeze(out1) uoc.output
%st1=@left(out1(6,1),11)
if %st1="Convergence" then
!row = !row+1
results(!row,1) = uoc.@logl
results(!row,2) = out1(6,1)
results(!row,3) = uoc.@aic
results(!row,4) = uoc.@sc
results(!row,5) = uoc.@hq
' store initial values of the parameters
for !k=1 to !paramnumber step 1
results(!row,5+!k)=start(!k)
next
' store final values of the parameters
for !k=1 to !paramnumber step 1
results(!row,5+!paramnumber+!k)=C(!k)
next
if uoc.@logl > !loglik then
!loglik = uoc.@logl
delete solution
copy uoc solution
endif
endif
delete out1
delete uoc
next
series se
series sa
' series se3
' series se4
' series se5
' series se6
solution.makesignals(t=disturb) se
solution.makestates(t=disturb) sa
stop
the following code leads to "illegal or reserved name" regarding makesignals and makestates. Why?
Hint: makesignals and makestates are on the bottom of the code
Many thanks for your help
wfcreate(wf=uoc, page=uoc) d(1,5) 7/1/2009 1/12/2016
!obstotal = @obssmpl
' counts the number of observations in the sample
!varnr = 5
' counts the number of variables in the model
!paramnumber = 2
'counts the number of parameters of the state space model considered
matrix(!obstotal,!varnr) datamat
' generates a matrix for the data
datamat.read(b2,s=Tabelle1) "E:\Dissertation\Daten Dissertation\Daten endgültig.xls"
' reads the data from the excel sheet into the data matrix
series cds_spread
series aktienkurs
series historische_volatilitaet
series implizite_volatilitaet
series risikoloser_zinssatz
' generates a series for the variable
group variables cds_spread aktienkurs historische_volatilitaet implizite_volatilitaet risikoloser_zinssatz
mtos(datamat,variables)
' converts the data matrix to the series defined above
' generate state space model and save loglikelihood:
sspace solution
!loglik=-1000000
table results
results(1,1)="LogLik"
results(1,2)="Result"
results(1,3)="AIC"
results(1,4)="Schwarz"
results(1,5)="Hannan-Quinn"
!row=1
for !i=1 to 10 step 1
smpl @all
series start = (-1+2*rnd)
for !j=1 to !paramnumber step 1
!startvar=start(!j)
param c(!j) !startvar
next
smpl 7/1/2009 1/12/2016
sspace uoc
uoc.append @ename e1
uoc.append @ename e2
uoc.append @ename e3
uoc.append @ename e4
uoc.append @ename e5
uoc.append @ename e6
uoc.append @evar var(e1) = exp(c(1))
uoc.append @evar var(e2) = exp(c(2))
uoc.append @evar var(e3) = exp(c(3))
uoc.append @evar var(e4) = exp(c(4))
uoc.append @evar var(e5) = exp(c(5))
uoc.append @evar var(e6) = exp(c(6))
uoc.append @state sv1=sv1(-1)+ e2
'uoc.append @state sv3=sv2(-1)
'uoc.append @state sv4=sv4(-1)
'uoc.append @state sv5=sv5(-1)
'uoc.append @state sv6=sv6(-1)
' uoc.append @state sv2=sv2(-1)
' uoc.append @state sv3=sv3(-1) + e4
' uoc.append @state sv4=sv4(-1)
' uoc.append @state sv5=sv5(-1) + e6
uoc.append @signal cds_spread=sv1 +e1
uoc.ml(m=1000,c=1e-6)
freeze(out1) uoc.output
%st1=@left(out1(6,1),11)
if %st1="Convergence" then
!row = !row+1
results(!row,1) = uoc.@logl
results(!row,2) = out1(6,1)
results(!row,3) = uoc.@aic
results(!row,4) = uoc.@sc
results(!row,5) = uoc.@hq
' store initial values of the parameters
for !k=1 to !paramnumber step 1
results(!row,5+!k)=start(!k)
next
' store final values of the parameters
for !k=1 to !paramnumber step 1
results(!row,5+!paramnumber+!k)=C(!k)
next
if uoc.@logl > !loglik then
!loglik = uoc.@logl
delete solution
copy uoc solution
endif
endif
delete out1
delete uoc
next
series se
series sa
' series se3
' series se4
' series se5
' series se6
solution.makesignals(t=disturb) se
solution.makestates(t=disturb) sa
stop