Page 1 of 1

OLS Regression

Posted: Tue Nov 22, 2011 9:02 am
by nic
Hi All,

My question may appear to be very trivial one, but I just wanted to figure out why Eviews adjusts the sample even in a simple OLS (this causes difference in intercept and slope coefficients).
Here is the result for eviews vs stata for simple OLS. The regressor is a dummy variable. There are 39 annual observations.

eviews
Dependent Variable: stock
Method: Least Squares
Date: 11/20/11 Time: 5:46
Sample (adjusted): 1 38
Included observations: 38 after adjustments

Variable Coefficient Std. Error t-Statistic Prob.

C(1) 3.751698 0.463424 8.095601 0.0000
dummy 1.535652 0.560253 2.740998 0.0095

R-squared 0.172662 Mean dependent var 4.802407
Adjusted R-squared 0.149681 S.D. dependent var 1.740918
S.E. of regression 1.605349 Akaike info criterion 3.835755
Sum squared resid 92.77722 Schwarz criterion 3.921944
Log likelihood -70.87935 Durbin-Watson stat 0.684805

and stata


. regress stock, dummy

Source | SS df MS Number of obs = 39
-------------+------------------------------ F( 1, 37) = 6.46
Model | 16.77298 1 16.77298 Prob > F = 0.0153
Residual | 96.0338703 37 2.59551001 R-squared = 0.1487
-------------+------------------------------ Adj R-squared = 0.1257
Total | 112.80685 38 2.96860132 Root MSE = 1.6111

------------------------------------------------------------------------------
stock | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
dummy | 1.391166 .5472494 2.54 0.015 .2823337 2.499999
_cons | 3.896184 .4468273 8.72 0.000 2.990825 4.801542

Your help will be highly appreciated.

Re: OLS Regression

Posted: Tue Nov 22, 2011 9:17 am
by startz
You probably have a different data. You might post your workfile including the equation you've estimated.

Re: OLS Regression

Posted: Tue Nov 22, 2011 9:31 am
by nic
You probably have a different data. You might post your workfile including the equation you've estimated.
Thank you startz for the prompt response. I double checked the data for both. Here are the data and equation I wanted to estimate.
stock dummy
7.24 1
5.96 1
6.11 1
7.22 1
6.01 1
5.96 1
4.65 0
5.04 0
4.19 0
6.09 0
4.83 1
3.67 1
4.96 1
3.96 1
4.50 1
5.93 1
5.26 1
3.63 1
6.26 1
6.66 1
7.86 1
7.22 1
6.12 0
5.26 0
3.26 0
2.21 0
1.80 0
0.38 0
2.42 0
3.61 0
7.15 1
5.94 1
4.57 1
3.81 1
2.49 1
4.01 1
2.66 1
3.58 1
5.63 0

equation: stock=intercept + b*dummy

Re: OLS Regression

Posted: Tue Nov 22, 2011 9:42 am
by EViews Gareth
You specified your equation as:

Code: Select all

stock c(1) dummy
You should enter it as:

Code: Select all

stock c dummy
By using c(1) you are telling EViews to use a one period lead on the variable C. Which means there are only 38 valid observations to use.

Re: OLS Regression

Posted: Tue Nov 22, 2011 9:44 am
by nic
You specified your equation as:

Code: Select all

stock c(1) dummy
You should enter it as:

Code: Select all

stock c dummy
By using c(1) you are telling EViews to use a one period lead on the variable C. Which means there are only 38 valid observations to use.
Thank you so much for clearing out my confusion.

Re: OLS Regression

Posted: Tue Nov 22, 2011 11:24 am
by startz
You specified your equation as:

Code: Select all

stock c(1) dummy
By using c(1) you are telling EViews to use a one period lead on the variable C. Which means there are only 38 valid observations to use.
This strikes me as a bug. C is not a series. For example,

Code: Select all

coef f ls y f(1) x
errors out.

Re: OLS Regression

Posted: Tue Nov 22, 2011 11:51 am
by EViews Gareth
C is both a coefficient vector, and a series.

When you specify:

Code: Select all

ls y c x
You are using C as a series (a series of ones).