R Squared Vector for the General Case
Posted: Tue Jun 23, 2015 7:49 am
Hello,
I'm writing a tangent question on the intro to Eviews programming. I beleive it is the 4th program where a string loop is used to regress the variables on each other, then create a vector to store the respective r2s.
In the example...
Vector size: 10
Variables used: 5
I'm interested in writing a code for the general case( the case of regressing variables on each other); that is to say a case involving n regressors. So the point here is to replace:
with a code that calculates the size of the vector based on how many variables are involved. I'm guessing this can be done by using the group.@count syntax. However, I don't know the mathematical formula to calculate the vector size. It can't be as simple as 5*2=10, or is it? Maybe factorials are involved? It may look like:
This way no mater how many variables we have, the vector size will be adequate.
Maybe someone who has a good handle on math can share a tip to this extent?
Thank you
I'm writing a tangent question on the intro to Eviews programming. I beleive it is the 4th program where a string loop is used to regress the variables on each other, then create a vector to store the respective r2s.
In the example...
Vector size: 10
Variables used: 5
I'm interested in writing a code for the general case( the case of regressing variables on each other); that is to say a case involving n regressors. So the point here is to replace:
Code: Select all
vector(10) r2sCode: Select all
vector(fancy math formula) r2sMaybe someone who has a good handle on math can share a tip to this extent?
Thank you