Fixed Effects Regression

Reply
Regular Contributor
Posts: 183

Fixed Effects Regression

Hi,

Which is the proper way to run a fixed effect regression: proc reg or proc panel?

I have the following variables in my dataset: companyISIN, year, car, mv, ta, roa, ni, dy etc. car will be dependent variable and all other variables (except companyISIN and year) are independent variables.

For OLS regression, I run the following codes:

proc reg data = x;

model car = mv ta roa ni dy;

output out = fittedvals predicted fitted;

run;

Please correct me if there are mistakes here.

But for the fixed effects or random effects model, I run the following codes but it does not work:

proc panel data = x;

model car = mv ta roa ni dy / fixone;

id CompanyISIN year;

run;

I also would like to run the GMM model. How can I do all of these?

Super User
Posts: 10,044

Re: Fixed Effects Regression

Posted in reply to AbuChowdhury

You can try proc glm for fixed effect and proc mixed for random effects.

Super User
Posts: 10,044

Re: Fixed Effects Regression

Posted in reply to AbuChowdhury

You can try proc glm for fixed effect and proc mixed for random effects.

Regular Contributor
Posts: 183

Re: Fixed Effects Regression

Hi,

would you please write the codes? I am not familiar with these procs.

I am including the data file. I also need to do the log of mv variable and roa/100. So the dependent variable will be car5 and independent variables will be bm, log of mv, roa/100, and dy.

In the regression, there will be two fixed effects: firm (i.e. companyISIN) and year.

Attachment
Respected Advisor
Posts: 2,655

Re: Fixed Effects Regression

Posted in reply to AbuChowdhury

Both procedures have tons of worked out examples in the documentation.  It almost always works out better if you code it yourself, and if it doesn't work, ask for help then.  Also, search the archives of the Statistical Procedures forum (for GLM and MIXED).  There are hundereds of examples of code there
Examples of PROC PANEL code are available both in the documentation and in the Forcasting and Econometrics forum.

Steve Denham

Regular Contributor
Posts: 183

Re: Fixed Effects Regression

Hi Xia,

I am also waiting for your reply. Thanks.

Super User
Posts: 10,044

Re: Fixed Effects Regression

Posted in reply to AbuChowdhury

Sorry. Currently I am learning Statistical theory ,although I have some statistical background in my university . But I can't offer you more information. Doc Steve is expert about it. Maybe you should ask him more questions.

Xia Keshan

Respected Advisor
Posts: 2,655

Re: Fixed Effects Regression

Abu, see my remarks upstream.  There are many examples in the documentation for both procedures.  What sort of errors occurred in the PROC PANEL run?  Please list them.

Steve Denham

Regular Contributor
Posts: 183

Re: Fixed Effects Regression

Posted in reply to SteveDenham

Hi Steve,

Proc panel works if I delete all blank observations. If there is any blank observation for any variable, then it does not work. Is it the case for proc panel?

Respected Advisor
Posts: 2,655

Re: Fixed Effects Regression

Posted in reply to AbuChowdhury

Not real sure of your meaning "it does not work."  According to the documentation: Any observation in the input data set with a missing value for one or more of the regressors is ignored by PROC PANEL, and is not used in the model fit.  The same is true of the other fixed effects regression packages in SAS, such as REG or GLM.  No matter what you do, in these procedures, those observations will be excluded.  This is especially frustrating for time series analysis

What can be done?  Imputation, such as PROC MI, then PROC PANEL by imputation number, then PROC MIANALYZE is one way.  PROC EXPAND for time series data is a second  Random effects regression is another, if the data are at least missing at random.

Steve Denham

Regular Contributor
Posts: 183

Re: Fixed Effects Regression

Posted in reply to SteveDenham

It does not work means it shows the error messages such as:

ERROR: Each observation for time point CompanyISIN=US01988P1084 has a missing value for at least

       one variable in MODEL statement .

NOTE: The SAS System stopped processing this step because of errors.

Other procedures such as proc reg or proc glm exclude the missing observations and show the results, but if there is any missing observation and if I submit the proc panel, then it does not run and hence it does not show the results, rather processing has been stopped (the above error message).

But if I delete all missing observations for all variables then proc panel works and shows the results.

Respected Advisor
Posts: 2,655

Re: Fixed Effects Regression

Posted in reply to AbuChowdhury

Ahh.  The two-way (company*time) comes up missing and so PANEL will stop.  However, if you delete all missing observations, the time series will not be aligned correctly for the time series by company.  I would find any values obtained to be suspect.  I would strongly encourage the use of PROC EXPAND to impute the missing values in each company's time series as a first step, and then proceed to use PROC PANEL.

Steve Denham

Regular Contributor
Posts: 183

Re: Fixed Effects Regression

Posted in reply to SteveDenham

Thanks but what codes should I write in proc expand? I will be grateful if you tell me.

Respected Advisor
Posts: 2,655

Re: Fixed Effects Regression

Posted in reply to AbuChowdhury

I will be upfront on this--I have never done it, so have no code to share.  Search the Econometrics and Forecasting forum, as well as the Procedures forum.  Many other people have posted on how to implement PROC EXPAND--that is how I knew of it.

Steve Denham

SAS Employee
Posts: 416

Re: Fixed Effects Regression

Posted in reply to SteveDenham

Hello -

As pointed out replacing missing values will be needed, but of course there are many ways how to go about this.

One way is to use PROC EXPAND to interpolate missing values: http://support.sas.com/documentation/cdl/en/etsug/66840/HTML/default/viewer.htm#etsug_expand_getting...

Another way might be to replace the missing values with a fixed values such as a numeric (0), mean, max, min, etc.

PROC TIMESERIES allows you to do that - see setmissing option of ID statement for example: http://support.sas.com/documentation/cdl/en/etsug/66840/HTML/default/viewer.htm#etsug_timeseries_exa...

Thanks,

Udo

Ask a Question
Discussion stats
  • 14 replies
  • 1475 views
  • 0 likes
  • 4 in conversation