wls | R Documentation |
Computes the weighted least squares estimate of the coefficients.
wls(X, Y, w = NULL, return_se = FALSE)
X |
(matrix): n x p matrix of covariates. |
Y |
(vector): p-vector of outcome values. |
w |
(vector, optional): n-vector of sample weights. |
return_se |
(bool, optional): Whether to return the standard errors of the coefficients. |
(list): A list containing the following:
(vector): p-vector of weighted least squares estimates of the coefficients.
(vector): If return_se == TRUE, return the p-vector of standard errors of the coefficients.
n <- 1000
X <- rnorm(n, 1, 1)
w <- rep(1, n)
Y <- X + rnorm(n, 0, 1)
wls(X, Y, w = w, return_se = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.