Dear Folks,
I've been trying to make a simple program to run a matrix form of OLS by using eviews.
My problem is so simple but can't find answer by myself.
That is,
let's suppose there are a simple equation as below;
y = c + b*x + u
so, I have a data of x (small x - independent variable) now and trying to estimate the coefficient of b by OLS.
Then, we know that b = @inverse(@transpose(X)*X)*X'Y; here large X is a matrix of having the column vector of ones and independent variable x (small x).
But I do not know how to make this large X matrix by using eviews command.
Could you help me to solve this problem?
Thank you very much!
HIS
how to make a program to produce a OLS coeffients by using matrix calculation?
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: how to make a program to produce a OLS coeffients by using matrix calculation?
Put the X variables (including "c" for the constant) in to a group, then use the stom command to convert that group into a matrix.
Follow us on Twitter @IHSEViews
Re: how to make a program to produce a OLS coeffients by using matrix calculation?
Thank you very much for your kind answer!
I did following program as you mentioned and it worked nicely.
series x0=log(sandp)
group x1 c x0
stom(x1, x2)
vector y = log(ford)
vector b = @inverse(@transpose(x2)*x2)*@transpose(x2)*y
show b
series y1=log(ford)
ls y1 c x0
By the way, I still have more questions if you would be ok;
that is, can i use only matrix command of eviews and just make the new matrix including c and x data not using group?
Could you kindly help me out this problem?
Gracias!
HIS
I did following program as you mentioned and it worked nicely.
series x0=log(sandp)
group x1 c x0
stom(x1, x2)
vector y = log(ford)
vector b = @inverse(@transpose(x2)*x2)*@transpose(x2)*y
show b
series y1=log(ford)
ls y1 c x0
By the way, I still have more questions if you would be ok;
that is, can i use only matrix command of eviews and just make the new matrix including c and x data not using group?
Could you kindly help me out this problem?
Gracias!
HIS
Who is online
Users browsing this forum: No registered users and 29 guests