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
question on putting an initial value smaller than 1 for LOO
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
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
It isn't very clear what you're trying to do with this line:
If g is not an integer, what does this line mean?
Code: Select all
resumsq_loan(g) = @ssr
Re: question on putting an initial value smaller than 1 for LOO
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
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
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
this should work. thank you for your replies
Who is online
Users browsing this forum: No registered users and 2 guests
