question on putting an initial value smaller than 1 for LOO

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

vasilika
Posts: 12
Joined: Thu Aug 05, 2010 4:32 am

question on putting an initial value smaller than 1 for LOO

Postby vasilika » Thu Aug 05, 2010 5:01 am

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

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13602
Joined: Tue Sep 16, 2008 5:38 pm

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

Postby EViews Gareth » Thu Aug 05, 2010 6:29 am

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?

vasilika
Posts: 12
Joined: Thu Aug 05, 2010 4:32 am

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

Postby vasilika » Fri Aug 06, 2010 4:51 am

this means that I want to save the value of equation residual for each g (from 0.1 to 39.4)

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13602
Joined: Tue Sep 16, 2008 5:38 pm

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

Postby EViews Gareth » Fri Aug 06, 2010 7:15 am

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.

tchaithonov
Posts: 168
Joined: Mon Apr 13, 2009 7:39 am
Location: New York City

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

Postby tchaithonov » Fri Aug 06, 2010 9:57 am

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?

vasilika
Posts: 12
Joined: Thu Aug 05, 2010 4:32 am

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

Postby vasilika » Tue Aug 10, 2010 1:14 am

this should work. thank you for your replies


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests