I would like to sum over the index j.
Assume you have 100 time series x(j) and you wish to sum over(j):
y = sum(j, x(j))
with the objective to get the following ratio:
contribution(j) = x(j) / y
This in Eviews 7.2 does not work
for !j = 1 to 100
scalar y = @sum(j,x_{!j})
next
Summation over an index
Moderators: EViews Gareth, EViews Moderator
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Summation over an index
I don't understand what you're trying to do.
Follow us on Twitter @IHSEViews
Re: Summation over an index
I want to sum
y = x1 + x2 + x3 + x4 + ...... x100
y = x1 + x2 + x3 + x4 + ...... x100
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Summation over an index
Code: Select all
group g x*
series y = @rsum(g)
Follow us on Twitter @IHSEViews
Re: Summation over an index
I KNOW contribution_{!i}_20_1 UP TO contribution_{!i}_20_20
SORRY BUT THIS DOES NOT WORK
for !i = 1 to !n
group g contribution_{!i}_20_*
scalar contribution_{!i}_20_0120 = @rsum(g)
next
SORRY BUT THIS DOES NOT WORK
for !i = 1 to !n
group g contribution_{!i}_20_*
scalar contribution_{!i}_20_0120 = @rsum(g)
next
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Summation over an index
I don't understand. I assumed that your Xs were series. How do you want to sum multiple series into a scalar? You want the total sum, over both time and over series? Then that would be:
scalar y = @sum(@rsum(g))
scalar y = @sum(@rsum(g))
Follow us on Twitter @IHSEViews
-
- EViews Developer
- Posts: 2672
- Joined: Wed Oct 15, 2008 9:17 am
Re: Summation over an index
If I had to guess, I think the op wants
Code: Select all
group g x*
series gsum = @rsum(g)
for !i=1 to g.count
series xs!i = x!i/gsum
next
Re: Summation over an index
Sorry for the confusion, they are all scalar
I get an error message when I group using this command _*
I get an error message when I group using this command _*
-
- EViews Developer
- Posts: 2672
- Joined: Wed Oct 15, 2008 9:17 am
Re: Summation over an index
I'm completely lost. Could you try again to explain exactly what objects you are starting with (including names) and what you wish to end up with.
Re: Summation over an index
Assume that I have 100 scalar values: x1_1, x1_2, ....., x1_100
I would like to get the sum: y = x1_1 + x1_2 + ..... + x1_100
I would like to get the sum: y = x1_1 + x1_2 + ..... + x1_100
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Summation over an index
For scalar objects, you'll have to write out the sum manually.
Follow us on Twitter @IHSEViews
Return to “General Information and Tips and Tricks”
Who is online
Users browsing this forum: No registered users and 24 guests