wls: Get Weighted Least Squares of Your OLS Model

View source: R/wls.R

wlsR Documentation

Get Weighted Least Squares of Your OLS Model

Description

wls() takes an OLS model and re-estimates it using a weighted least squares approach. Weighted least squares is often a "textbook" approach to dealing with the presence of heteroskedastic standard errors, for which the weighted least squares estimates are compared to the OLS estimates of uncertainty to check for consistency or potential inferential implications.

Usage

wls(mod)

Arguments

mod

a fitted OLS model

Details

The function should be robust to potential model specification oddities (e.g. polynomials and fixed effects). It also should perform nicely in the presence of missing data, if and only if na.action = na.exclude is supplied first to the offending OLS model supplied to the function for a weighted least squares re-estimation.

Value

wls() returns a new model object that is a weighted least squares re-estimation of the OLS model supplied to it.

Author(s)

Steven V. Miller

Examples


M1 <- lm(mpg ~ ., data=mtcars)
M2 <- wls(M1)

summary(M2)

stevemisc documentation built on Sept. 11, 2024, 5:23 p.m.