wls: Weighted Least Squares

Description Usage Arguments Examples

View source: R/internal-lm.r

Description

Weighted Least Squares

Usage

1
wls(y, x, w, se = "HC0", cluster, cholesky = TRUE)

Arguments

y

outcome vector.

x

design matrix

w

weight matrix

se

character. How to calculate robust variance-covariance matrix ("HC0", "HC1", "HC2", "HCj", "HC3", and "HC4") If "standard", calculate conventional variance-covariance matrix

cluster

cluster variable.

cholesky

logical (default is TRUE). When solving normal equation, use cholesky decomposition.

Examples

1
2
3
4
5
6
7
8
## Not run: 
x <- cbind(x1 = rnorm(100), x2 = rnorm(100))
y <- x[, 1] + 2 * x[, 2] + rnorm(100)
w <- sample(c(1, 0.5), 100, TRUE)
est <- lm_internal(y, x)
est$estimate

## End(Not run)

KatoPachi/discreteRD documentation built on Feb. 24, 2022, 12:32 a.m.