# fgls

Feasible generalized least squares

## Syntax

## Description

returns coefficient estimates of the multiple linear regression model `coeff`

= fgls(`X`

,`y`

)`y`

= `X`

*β* + *ε* using feasible generalized least squares (FGLS) by first estimating the covariance of the innovations process *ε*.

`NaN`

s in the data indicate missing values, which `fgls`

removes using list-wise deletion. `fgls`

sets `Data`

= `[X y]`

, then it removes any row in `Data`

containing at least one `NaN`

. List-wise deletion reduces the effective sample size and changes the time base of the series.

returns FGLS coefficient estimates using the predictor data in the first `coeff`

= fgls(`Tbl`

)`numPreds`

columns of the table `Tbl`

and the response data in the last column.

`fgls`

removes all missing values in `Tbl`

, indicated by `NaN`

s, using list-wise deletion. In other words, `fgls`

removes all rows in `Tbl`

containing at least one `NaN`

. List-wise deletion reduces the effective sample size and changes the time base of the series.

specifies options using one or more name-value pair arguments in addition to the input arguments in previous syntaxes. For example, you can choose the innovations covariance model, specify the number of iterations, and plot estimates after each iteration.`coeff`

= fgls(___,`Name,Value`

)

`[`

additionally returns a vector of FGLS coefficient standard errors, `coeff`

,`se`

,`EstCoeffCov`

]
= fgls(___)`se`

= `sqrt(diag(EstCov))`

, and the FGLS estimated coefficient covariance matrix (`EstCoeffCov`

).

`[`

returns handles to plotted graphics objects. Use elements of `coeff`

,`se`

,`EstCoeffCov`

,`iterPlots`

] = fgls(___)`iterPlots`

to modify properties of the plots after you create them.

## Examples

## Input Arguments

## Output Arguments

## More About

## Tips

To obtain standard generalized least squares (GLS) estimates:

To obtain WLS estimates, set the

`InnovCov0`

name-value pair argument to a vector of inverse weights (e.g., innovations variance estimates).In specific models and with repeated iterations, scale differences in the residuals might produce a badly conditioned estimated innovations covariance and induce numerical instability. If you set

`'resCond',true`

, then conditioning improves.

## Algorithms

In the presence of nonspherical innovations, GLS produces efficient estimates relative to OLS, and consistent coefficient covariances, conditional on the innovations covariance. The degree to which

`fgls`

maintains these properties depends on the accuracy of both the model and estimation of the innovations covariance.Rather than estimate FGLS estimates the usual way,

`fgls`

uses methods that are faster and more stable, and are applicable to rank-deficient cases.Traditional FGLS methods, such as the Cochrane-Orcutt procedure, use low-order, autoregressive models. These methods, however, estimate parameters in the innovations covariance matrix using OLS, where

`fgls`

uses maximum likelihood estimation (MLE) [2].

## References

[1] Cribari-Neto, F. "Asymptotic Inference Under Heteroskedasticity of Unknown Form." *Computational Statistics & Data Analysis*. Vol. 45, 2004, pp. 215–233.

[2] Hamilton, J. D. *Time Series Analysis*. Princeton, NJ: Princeton University Press, 1994.

[3] Judge, G. G., W. E. Griffiths, R. C. Hill, H. Lutkepohl, and T. C. Lee. *The Theory and Practice of Econometrics*. New York, NY: John Wiley & Sons, Inc., 1985.

[4] Kutner, M. H., C. J. Nachtsheim, J. Neter, and W. Li. *Applied Linear Statistical Models*. 5th ed. New York: McGraw-Hill/Irwin, 2005.

[5] MacKinnon, J. G., and H. White. "Some Heteroskedasticity-Consistent Covariance Matrix Estimators with Improved Finite Sample Properties." *Journal of Econometrics*. Vol. 29, 1985, pp. 305–325.

[6] White, H. "A Heteroskedasticity-Consistent Covariance Matrix and a Direct Test for Heteroskedasticity." *Econometrica*. Vol. 48, 1980, pp. 817–838.

## See Also

`fitlm`

| `lscov`

| `hac`

| `regARIMA`

| `arma2ar`

### Topics

- Classical Model Misspecification Tests
- Time Series Regression I: Linear Models
- Time Series Regression VI: Residual Diagnostics
- Time Series Regression X: Generalized Least Squares and HAC Estimators
- Autocorrelation and Partial Autocorrelation
- Engle’s ARCH Test
- Nonspherical Models
- Time Series Regression Models

**Introduced in R2014b**