| zlm.wfit | R Documentation |
The function eventually called by lm(), lm.fit(), and/or lm.wfit() if fed complex data.
Performs ordinary (least-squares) linear fitting on complex variable data.
Like stats::lm.wfit(), which it is based off of, it uses qr decomposition
for the matrix algebra. Unlike stats::lm.wfit() it also handles un-weighted
regression, by setting the weights to 1 by default.
zlm.wfit(
x,
y,
w = rep(1L, ifelse(is.vector(x), length(x), nrow(x))),
offset = NULL,
method = "qr",
tol = 1e-07,
singular.ok = TRUE,
...
)
x |
a complex design matrix, |
y |
a vector of observations/responses of length |
w |
a vector of weights to be used in the fitting process. The sum of |
offset |
optional. A complex vector of length n that will be subtracted from y prior to fitting. |
method |
optional. a string that can be used to choose any method you would like. As long as it is "qr". |
tol |
tolerance for the qr decomposition. Default is 1e-7. |
singular.ok |
logical. If false, a singular model is an error. |
... |
currently disregarded. |
a list with components (for lm.fit and lm.wfit)
coefficients |
|
residuals |
|
fitted.values |
|
effects |
|
weights |
|
rank |
integer, giving the rank |
df.residual |
degrees of freedom of residuals |
qr |
the QR decomposition, see |
Fits without any columns or non-zero weights do not have the
effects and qr components.
.lm.fit() returns a subset of the above, the qr part
unwrapped, plus a logical component pivoted indicating if the
underlying QR algorithm did pivot.
set.seed(4242)
n <- 6
p <- 2
slop <- complex(real = 4.23, imaginary = 2.323)
slop2 = complex(real = 2.1, imaginary = -3.9)
interc <- complex(real = 1.4, imaginary = 1.804)
e <- complex(real=rnorm(n)/6, imaginary=rnorm(n)/6)
desmat <- matrix(c(complex(real = rnorm(n * p), imaginary = rnorm(n * p)), rep(1, n)), n, p + 1)
y = desmat %*% c(slop, slop2, interc) + e
lm.fit(desmat, y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.