Page 2 of 2

Re: How to deal with zeros in data?

Posted: Tue Feb 24, 2015 5:17 pm
by Aixia_Mei
TomDoan wrote:The following will give you a count of consecutive zeroes in the series x:

set(first=(x==0.0)) zerocount = %if(x==0,zerocount{1}+1,0.0)

Following your construction, I edit my codes, and it works.
Thanks for that.

But one more issue arises in the following codes:

***Setting dummy varibles
set ssmt = t>=2010:03:31
***Setting deterministic trend
set zerocount = %if(r1{1}==0,zerocount{1}+1,0.0)
set nt = zerocount
***
set v = %variance
set u = 0.0
frml et = r1-b0-b1*v-(b2+b3*v+b4*ssmt*v)*r1{1}
frml ot = %exp(a4*ssmt+%log(1+a5*nt))
frml ht = ot*(a0+a1*u{1}**2/ot{1}+a2*v{1}/ot{1}+%if(u{1}<0.0, a3*u{1}**2/ot{1}, 0.0))

For the line frml ot, RATS keeps reporting a mistake as:
## SX22. Expected Type REAL, Got MATRIX[REAL] Instead
>>>>smt+%log(1+a5*nt))<<<<

How can this mistake be solved?

Regards,
Aixia

Re: How to deal with zeros in data?

Posted: Tue Feb 24, 2015 7:25 pm
by TomDoan
exp and log are used for the scalar functions. %exp and %log are element-by-element matrix functions.

Re: How to deal with zeros in data?

Posted: Wed Feb 25, 2015 11:43 pm
by Aixia_Mei
Many thanks Tom.

One more question about the supplementary card. My codes are as follows:

***
restrict 1
#3 6
# 1.0-1.0 0.0
restrict 1
#4 7
# 1.0-1.0 0.0
restrict 1
#5 8
# 1.0-1.0 0.0

restrict 3
#3 6
# 1.0-1.0 0.0
#4 7
# 1.0-1.0 0.0
#5 8
# 1.0-1.0 0.0

But RATS reports a mistake as:
## SC3. Expected 3 Entries on Supplementary Card, Got 2

I can't understand where the problem is.

Regards,
Aixia

Re: How to deal with zeros in data?

Posted: Thu Feb 26, 2015 5:24 am
by TomDoan
# 1.0-1.0 0.0

No space between the 1.0 and -1.0.

Re: How to deal with zeros in data?

Posted: Tue Mar 31, 2020 7:04 am
by 1003064
Tom,

What is %LNGAMMA in the above code and where can I find more information on this?

Re: How to deal with zeros in data?

Posted: Tue Mar 31, 2020 8:30 am
by TomDoan