Page 1 of 1

regression

Posted: Tue Sep 06, 2011 11:57 pm
by jolly
Hi,

Can I ask for a help? I have a regression : y=c(1)*x1+c(2)*x2.
I generate x in this way:
genr x1=1
genr x2=(@trend+1)/10

How can i generate 100 such x using matrix? because I need this regression: y=c(1)*x1+c(2)*x2+...+c(100)*x100

I don't know how to do it in eviews. and what function to use..

Re: regression

Posted: Wed Sep 07, 2011 12:51 am
by trubador
I am not sure what you are asking, but the following piece of code might guide you. Just copy and paste it into program window (i.e. File/New/Program).

Code: Select all

'Define a coefficient vector coef(100) beta 'Assign random (uniform) values to coefficents rnd(beta) 'Define the dependent variable series y 'Define the disturbance term series u = 2*nrnd 'Generate a group for independent variables instead of a matrix group indep 'Generate the first series (i.e. the constant variable) series x1 = 1 'Add the first variable to the group indep.add x1 'Begin generating the values of dependent variable series y = beta(1)*x1 'Define a loop to generate other independent variables for !i = 2 to 100 series x!i = nrnd 'You should introduce some sort of randomness to each independent variable in order to avoid multicollinearity indep.add x!i 'Add each variable to the group y = y + beta(!i)*x!i 'Continue to generate the values of dependent variable next 'Add the disturbance term y = y + u 'Estimate your regression equation eq1.ls y indep

Re: regression

Posted: Wed Sep 07, 2011 6:19 am
by jolly
thank you!

Re: regression

Posted: Wed Sep 07, 2011 7:13 am
by jolly
but why when i try this code. in equation all: Std. Error t-Statistic Prob. are NA?

Re: regression

Posted: Wed Sep 07, 2011 7:32 am
by trubador
That is probably because you run out of degrees-of-freedom. Try to resize the range of your workfile and make sure the number of observations are greater than that of estimated coefficents.

Re: regression

Posted: Wed Sep 07, 2011 8:11 am
by jolly
yes, you'are right!
And another question ( I hope so it'll be last) :
obviously, my task is to show that fisher criterion distribution when Ho is true, goes to F(k-m,N-k) when degrees of freedom are increasing. So I'm generating one regression with 100 x, and another with 10. So in which one I can say dregrees o freedom is bigger?

Re: regression

Posted: Fri Nov 13, 2015 9:12 am
by gsourop
Hi everyone!

I have created a group of independent variables, say x1 x2 x3 up to x150
group xs
for %i x1 x2 x3 'up to 150
xs.add {%i}
next

and I want o regress each one to my dependent variable, say log_spot
So I want to iterate the regression

ls log_spot c x1
ls log_spot c x2
ls log_spot c x3
....
ls log_spot c x150

does anyone have a clue how I can do it, not manually?????Thanks in advance!