# het.lmfit: Heteroscedastic linear models for large scale data In Rfast2: A Collection of Efficient and Extremely Fast R Functions II

## Description

Heteroscedastic linear models for large scale data.

## Usage

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

## Arguments

 `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 or a numerical matrix. `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).

## Details

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.

## Value

A list including:

 `be` The beta coefficients. `residuals` The residuals of the linear model(s).

## Author(s)

Michail Tsagris

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

## References

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.

``` cls, cluster.lm, lm.parboot, cor_test, lm.drop1 ```
 ```1 2 3 4``` ```x <- cbind(1, matrix( rnorm( 100 * 4), ncol = 4 ) ) y <- rnorm(100) a <- het.lmfit(x, y) x <- NULL ```