# nlshc: Heteroscedastic Nonlinear Regression In matloff/regtools: Regression and Classification Tools

 nlshc R Documentation

## Heteroscedastic Nonlinear Regression

### Description

Extension of `nls` to the heteroscedastic case.

### Usage

```nlshc(nlsout,type='HC')
```

### Arguments

 `nlsout` Object of type 'nls'. `type` Eickert-White algorithm to use. See documentation for nls.

### Details

Calls `nls` but then forms a different estimated covariance matrix for the estimated regression coefficients, applying the Eickert-White technique to handle heteroscedasticity. This then gives valid statistical inference in that setting.

Some users may prefer to use `nlsLM` of the package minpack.lm instead of `nls`. This is fine, as both functions return objects of class 'nls'.

### Value

Estimated covariance matrix

Norm Matloff

### References

Zeileis A (2006), Object-Oriented Computation of Sandwich Estimators. Journal of Statistical Software, 16(9), 1–16, https://www.jstatsoft.org/v16/i09/.

### Examples

```# simulate data from a setting in which mean Y is
# 1 / (b1 * X1 + b2 * X2)
n <- 250
b <- 1:2
x <- matrix(rexp(2*n),ncol=2)
meany <- 1 / (x %*% b)  # reg ftn
y <- meany + (runif(n) - 0.5) * meany  # heterosced epsilon
xy <- cbind(x,y)
xy <- data.frame(xy)
# see nls() docs
nlout <- nls(X3 ~ 1 / (b1*X1+b2*X2),
data=xy,start=list(b1 = 1,b2=1))
nlshc(nlout)
```

matloff/regtools documentation built on July 17, 2022, 10:10 a.m.