Calculate the product of all data values in a series?
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
Calculate the product of all data values in a series?
Anyone tells me how to calculate the product of all data values in a series? I cannot find any function to do this. Thanks.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13600
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Calculate the product of all data values in a series?
scalar sc1 = @prod(FTSE_return)
--> error message: @prod is an illegal name
Plz take a check, QMS Gareth!
I am using EViews 5.0
--> error message: @prod is an illegal name
Plz take a check, QMS Gareth!
I am using EViews 5.0
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13600
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Calculate the product of all data values in a series?
It doesn't work in EViews 5. Please post in the correct forum in the future.
Re: Calculate the product of all data values in a series?
I am using 'for' loop to solve this problem. Thank you, QMS Gareth.
-
startz
- Non-normality and collinearity are NOT problems!
- Posts: 3797
- Joined: Wed Sep 17, 2008 2:25 pm
Re: Calculate the product of all data values in a series?
You may also be able to doI am using 'for' loop to solve this problem. Thank you, QMS Gareth.
Code: Select all
series product=FTSE_return
smpl 2 @last
product = product(-1)*FTSE_return-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Calculate the product of all data values in a series?
If all of the values in the series are positive, then
is another v5 way of getting what you want. Note that overflow or zero values are quite common for long series. Are you sure you want the product or do you want to work in a transformed space (e.g., log)?
Code: Select all
scalar prod2 = exp(@sum(@log(s1)))
Who is online
Users browsing this forum: No registered users and 2 guests
