a loop function to do integral

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

a loop function to do integral

Joanne Tsai
Hi, Dear colisters:

I have a question regarding manipulating the data below. I would like to
calculate the integral of A1, A2 and A3 by summing up from t=0 to t=t.

In the end, I'd like to have three additional columns, A11, A22, A33
corresponding to A1, A2, and A3. A11 should be the summation of A1 from
t=0 to t=t.

I.e. At T=4, A11 should calculate 0+0.01+0.016+0.023+0.03, and A33
should be 0+0.5+0.53+0.48+0.4.

I hope my attempt and explanation is clear. My first thought is to do a
loop function, but I couldn't quite figure out. I appreciate your help!

Thank you.

 

 

market

prod

Period (t)

A1

A2

A3

a

b

0

           0    

           0

          0

a

b

1

0.01

0.01

0.5

a

b

2

0.016

0.02

0.53

a

b

3

0.023

0.03

0.48

a

b

4

0.03

0.04

0.4

a

b

5

0.039

0.04

0.45

a

b

6

0.044

0.05

0.48

 

 

Joanne

====================To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD