View source: R/regression_models.R

Heteroscedastic linear models for large scale data | R Documentation |

Heteroscedastic linear models for large scale data.

```
het.lmfit(x, y, type = 1)
```

`x` |
The design matrix with the data, where each column refers to a different sample of subjects. You must supply the design matrix, with the column of 1s. This function is the analogue of lm.fit and .lm.fit. |

`y` |
A numerical vector with the response variable. |

`type` |
The type of regression to be fit in order to find the weights. The type 1 is described in Wooldridge (2012, page 287), whereas type 2 is described in page Wooldridge (2012, page 287). |

We have simply exploitted R's powerful function and managed to do better than .lm.fit which is a really powerful function as well. This is a bare bones function as it returns only two things, the coefficients and the residuals. .lm.fit returns more and lm.fit even more and finally lm returns too much. The addition is that we allow for estimation of the regression coefficients when heteroscedasticity is present.

A list including:

`be` |
The beta coefficients. |

`residuals` |
The residuals of the linear model(s). |

Michail Tsagris.

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.

Introductory Econometrics. A modern approach. Mason, South-Western Cengage Learning, 5th Edition.

Draper, N.R. and Smith H. (1988). Applied regression analysis. New York, Wiley, 3rd edition.

```
covrob.lm, cls, cluster.lm, lm.parboot, cor_test, lm.drop1
```

```
x <- cbind(1, matrix( rnorm( 100 * 4), ncol = 4 ) )
y <- rnorm(100)
a <- het.lmfit(x, y)
x <- NULL
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.