Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Forecasting
- /
- How to do feasible generalized least square (FGLS) in SAS?

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 06-17-2016 02:07 PM
(4186 views)

Hi all,

I am re-posting this question to a the SAS Forecasting and Econometrics board as suggested by another user. I was trying to do a feasible generalized least square (FGLS) in SAS 9.2 to adjust for heteroscedasticity. The form of the variance is unknown. I am just trying to use the residuals to estimate the variance and then do an iterative reweighting (I think this is what FGLS is).

I googled it and found the SAS documentation here. But the documentation didn't explain very clearly how to implement FGLS in proc model. It only says using H.var. I tried the following code,

```
proc model data=temp ;
y=b0+b1*x1+b2*x2;
h.y=resid.y**2;
fit y /itprint ;
run;
```

but SAS says:

*WARNING: Can only do FIML or GMM estimation when parameters are shared by the mean model and the variance model. The estimation requested will ignore the variance model.*

So I believe the code is not doing FGLS.

My question is:

Can anyone provide an example code that will do a FGLS? I am OK with either proc model or any other procedures that will do the job.

Thank you all so much.

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

In PROC MODEL you must specify the form of the heteroscedasticity to perform a FGLS estimation, and the parameters in the variance equation cannot be shared with the mean equation parameters. In your code the variance model you are specifying is effectively

`h.y=(y-(b0+b1*x1+b2*x2))**2;`

which shares all the parameters in the mean equation.

In the case when the variance structure is unknown the estimation can be performed using the generalized method of moments (GMM). The code to do that is

```
proc model data=temp ;
y = b0+b1*x1+b2*x2;
h.y = resid.y**2;
fit y / gmm;
run;
```

3 REPLIES 3

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

In PROC MODEL you must specify the form of the heteroscedasticity to perform a FGLS estimation, and the parameters in the variance equation cannot be shared with the mean equation parameters. In your code the variance model you are specifying is effectively

`h.y=(y-(b0+b1*x1+b2*x2))**2;`

which shares all the parameters in the mean equation.

In the case when the variance structure is unknown the estimation can be performed using the generalized method of moments (GMM). The code to do that is

```
proc model data=temp ;
y = b0+b1*x1+b2*x2;
h.y = resid.y**2;
fit y / gmm;
run;
```

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

PROC MODEL does not have a built in option to do the reweighting; however, you could specify two FIT statements to perform the reweighting yourself:

```
proc model data=temp;
fit y / outactual out=o;
y = b0+b1*x1+b2*x2;
outvar resid.y;
fit y / data=o;
h.y = resid_y**2;
quit;
```

Are you ready for the spotlight? We're accepting content ideas for **SAS Innovate 2025** to be held May 6-9 in Orlando, FL. The call is **open **until September 25. Read more here about **why** you should contribute and **what is in it** for you!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.