Description Usage Arguments Details Value Author(s) Source Examples
lmHetero
accounts for heteroscedasticity in regression models
1 2 3 4 5 6 7 8 9 10 |
formula |
Formula object (perhaps, multiple parts formula
|
hetero |
Optional formula specification without " |
data |
An optional data frame containing the variables in the model. By default the variables are taken from the environment of the formula. |
subset |
An optional vector specifying a subset of observations to be used in fitting the model. |
na.action |
A function that indicates what should happen when the data
contain |
contrasts |
An optional list. See the " |
iter |
Logical indicating whether the interation history should be
displayed. The default setting if " |
... |
Currently not in use. |
This function estimates the parameters of a regression model whose normally distributed disturbances have a variance that multiplicatively depends on a set of strictly positive weights variables. That is,
σ^2_i = \exp(γ_0 + γ_1 \cdot \log(z_{i1}) + ...)
The weights variables z must be entered in their logarithmic forms. The paramater \exp(γ_0) expresses the global variance.
a list with 10 elements:
CALL |
function call |
sigma2 |
global variance estimate exp(gamma_0) |
gamma |
vector of estimated gamma coefficients |
namesGamma |
vector of variable names expressed by Z |
beta |
vector of estimated weight adjusted regression parameters |
weights |
vector of weights 1/σ^2_i estimates for each
observation. It can be used in the call |
covBeta |
covariance matrix of the estimated regression coefficients |
covGamma |
covariance matrix of the estimated gamma coefficients |
logLikeH1 |
log-likelihood of the heteroscedastic adjusted regression model |
logLikeH0 |
log-likelihood of the unadjusted regression model |
Michael Tiefelsdorf (tiefelsdorf@utdallas.edu) & Yongwan Chun
The maximum likelihood estimation procedure for multiplicately weighted regression is given in Greene W. H. (2000). Econometric Analysis. 4th edition. Upper Saddle River: Prentice Hall. pp 516-521 (Note: page numbers will differ for other editions)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | library(sp)
data(tractShp)
validTractShp <- tractShp[!is.na(tractShp$BUYPOW), ] # Remove 2 tracts with NA's
## Population at risk
totPop <- validTractShp$MALE+validTractShp$FEMALE
## H0 model (homoscedasticity)
mod.lm <- mod.lmH <- lmHetero(PERCAPINC~PCTNOHINS+PCTMINOR+PCTUNIVDEG+PCTWHITE,
data=validTractShp)
summary(mod.lm)
## Preferred heteroscedasticiy function call
mod.lmH <- lmHetero(PERCAPINC~PCTNOHINS+PCTMINOR+PCTUNIVDEG+PCTWHITE|log(totPop),
data=validTractShp)
summary(mod.lmH)
## Alternative equivalent heteroscedasticiy function call
mod.lmH <- lmHetero(PERCAPINC~PCTNOHINS+PCTMINOR+PCTUNIVDEG+PCTWHITE, hetero=~log(totPop),
data=validTractShp)
summary(mod.lmH)
## Use estimated weights as input for weighted lm-model.
## This also to perform further model diagnostics.
mod.lmW <- lm(PERCAPINC~PCTNOHINS+PCTMINOR+PCTUNIVDEG+PCTWHITE, weights=mod.lmH$weights,
data=validTractShp)
summary(mod.lmW)
hist(weighted.residuals(mod.lmW))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.