svyreg | R Documentation |
Weighted least squares estimator of regression
svyreg(formula, design, var = NULL, na.rm = FALSE)
formula |
a |
design |
an object of class |
var |
a one-sided |
na.rm |
|
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.
Object of class svyreg_rob
.
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
.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.