Page 1 of 1

question on putting an initial value smaller than 1 for LOO

Posted: Thu Aug 05, 2010 5:01 am
by vasilika
Hello

I am working on estimating a threshold relationship using the following program

scalar thold
scalar test
scalar i
scalar g
scalar numobs
scalar numth
series dum_thold
series resumsq_loan


numobs = 56
numth =394

for g =0.1 to numth step 0.1
dum_thold = 0
thold = grid(g)

for i=1 to numobs
test = inf(i)
if test > thold then
dum_thold(i) = 1
endif
next

equation thr_reg_loan.ls loan dum_thold*(1/inf-1/thold) (1-dum_thold)*(1/inf-1/thold) do fs trend

resumsq_loan(g) = @ssr
next


if I run it, I get the following result:

0 is not a valid index for vector-series-coefficient RESUMSQ_LOAN(g)@SSR

So the program doesn't run.

However if I put the initial value of g=1, than it works.

But I want to use loop for values from 0.1-394, step 0.1

Does anyone have a suggestion on this.

Thank you

Re: question on putting an initial value smaller than 1 for LOO

Posted: Thu Aug 05, 2010 6:29 am
by EViews Gareth
It isn't very clear what you're trying to do with this line:

Code: Select all

resumsq_loan(g) = @ssr
If g is not an integer, what does this line mean?

Re: question on putting an initial value smaller than 1 for LOO

Posted: Fri Aug 06, 2010 4:51 am
by vasilika
this means that I want to save the value of equation residual for each g (from 0.1 to 39.4)

Re: question on putting an initial value smaller than 1 for LOO

Posted: Fri Aug 06, 2010 7:15 am
by EViews Gareth
You'll need to create a variable that keeps track of how many iterations of the loop you've done, and use that is your index variable rather than G.

Re: question on putting an initial value smaller than 1 for LOO

Posted: Fri Aug 06, 2010 9:57 am
by tchaithonov
Perhaps a faster method is to use 1 to 3940 as your loop and divide everything by 10 whenever you need 0.1 to 394?

Re: question on putting an initial value smaller than 1 for LOO

Posted: Tue Aug 10, 2010 1:14 am
by vasilika
this should work. thank you for your replies