svyreg: Survey Regression Estimator - Weighted Least Squares

View source: R/svyreg.R

svyregR Documentation

Survey Regression Estimator – Weighted Least Squares

Description

Weighted least squares estimator of regression

Usage

svyreg(formula, design, var = NULL, na.rm = FALSE)

Arguments

formula

a [formula] object (i.e., symbolic description of the model)

design

an object of class survey.design; see svydesign.

var

a one-sided [formula] object or variable name ([character]) that defines the heteroscedastic variance or [NULL] indicating homoscedastic variance (default: NULL).

na.rm

[logical] indicating whether NA values should be removed before the computation proceeds (default: FALSE).

Details

Package survey must be loaded in order to use the functions.

svyreg computes the regression coefficients by weighted least squares.

Models for svyreg_rob are specified symbolically. A typical model has the form response ~ terms where response is the (numeric) response vector and terms is a series of terms which specifies a linear predictor for response; see formula and lm.

A formula has an implied intercept term. To remove this use either y ~ x - 1 or y ~ 0 + x; see formula for more details of allowed formulae.

Value

Object of class svyreg_rob.

See Also

Overview (of all implemented functions)

summary, coef, residuals, fitted, SE and vcov

plot for regression diagnostic plot methods

Robust estimating methods svyreg_huberM, svyreg_huberGM, svyreg_tukeyM and svyreg_tukeyGM.

Examples

data(workplace)

library(survey)
# Survey design for simple random sampling without replacement
dn <- svydesign(ids = ~ID, strata = ~strat, fpc = ~fpc, weights = ~weight,
    data = workplace)

# Compute the regression estimate (weighted least squares)
m <- svyreg(payroll ~ employment, dn)

# Regression inference
summary(m)

# Extract the coefficients
coef(m)

# Extract variance/ covariance matrix
vcov(m)

robsurvey documentation built on Jan. 6, 2023, 5:09 p.m.