I have the time series for 12 interest rates (700 obs each maturity). I would like to estimate each set of interest rates (e.g. maturities from 1month to 120months, think of it as a term structure) as a function of 3 variables (which might NOT vary over time) for each point in time (e.g. as if it is the 700 cross-section OLS estimations). The goal is to derive a time-series of coefficients from the 700 regression.
Suppose the model looks as follows:
Y c x1 x2
Below, I post an idea of how to do it for say two time periods, but it requires to create a two Y (Y1, Y2) and four X variables (X11, X12, X21, X22) for each time period (e.g. month 1 and month 2). The task will be very time consuming if I extend it to 700 repetitions.
Example for 2 data points
Code: Select all
'create vector where I suppose to store coefficients
vector(2) coefs
'create empty equation to be used inside the loop
equation eq
''counter of how many equations we have run
!rowcounter=1
'run pairwise regressions between each series
for !i=1 to 2
!rowcounter = !i
for !j=1 to 2
if !i<>!j then
equation eq{!i}.ls Y{!i} c X1{!i} X2{!i}
coefs(!rowcounter)=eq{!i}.@coefs(2)
endif
next
next
As you can see I manage to store only one coefficient at the time.
The questions would be how to force Eviews to take consecutive set of interest rates, run OLS, store 3 (!) coefficients (const, beta1, beta2) as a time series? How appropriately input the data?
Many thanks,
divac