regression

For econometric discussions not necessarily related to EViews.

Moderators: EViews Gareth, EViews Moderator

jolly
Posts: 18
Joined: Mon Jun 20, 2011 10:52 am

regression

Postby jolly » Tue Sep 06, 2011 11:57 pm

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..

trubador
Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

Re: regression

Postby trubador » Wed Sep 07, 2011 12:51 am

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

jolly
Posts: 18
Joined: Mon Jun 20, 2011 10:52 am

Re: regression

Postby jolly » Wed Sep 07, 2011 6:19 am

thank you!

jolly
Posts: 18
Joined: Mon Jun 20, 2011 10:52 am

Re: regression

Postby jolly » Wed Sep 07, 2011 7:13 am

but why when i try this code. in equation all: Std. Error t-Statistic Prob. are NA?

trubador
Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

Re: regression

Postby trubador » Wed Sep 07, 2011 7:32 am

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.

jolly
Posts: 18
Joined: Mon Jun 20, 2011 10:52 am

Re: regression

Postby jolly » Wed Sep 07, 2011 8:11 am

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?

gsourop
Posts: 18
Joined: Wed Nov 11, 2015 11:46 am

Re: regression

Postby gsourop » Fri Nov 13, 2015 9:12 am

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!


Return to “Econometric Discussions”

Who is online

Users browsing this forum: No registered users and 31 guests