Learn R Programming

complexlm (version 1.1.2)

rstandard.zlm: Standardized Residuals from Ordinary or Robust Linear fits with Complex Variables

Description

Generates a vector of residuals from the given complex linear model that are normalized to have unit variance. Similar to stats::rstandard, which this function calls if given numeric input.

Usage

# S3 method for zlm
rstandard(model, lever = zhatvalues(model), ...)

Value

A complex vector of length equal to that of the residuals of model. Numeric for numeric input.

Arguments

model

An object of class "zlm", "rzlm", "lm", or "rlm". Can be complex or numeric.

lever

A list of leverage scores with the same length as model$residuals. By default zhatvalues is called on model.

...

Other parameters. Only used if model is numeric; in which case they are passed to stats::rstandard.

Details

The standardized residuals are calculated as,
$$r' = r / ( s \sqrt{1 - lever} )$$
Where \(r\) is the residual vector and \(s\) is the residual standard error for "zlm" objects or the robust scale estimate for "rzlm" objects.

See Also

Examples

Run this code
set.seed(4242)
n <- 8
slop <- complex(real = 4.23, imaginary = 2.323)
interc <- complex(real = 1.4, imaginary = 1.804)
e <- complex(real=rnorm(n)/6, imaginary=rnorm(n)/6)
xx <- complex(real= rnorm(n), imaginary= rnorm(n))
tframe <- data.frame(x = xx, y= slop*xx + interc + e)
fit <- lm(y ~ x, data = tframe, weights = rep(1,n))
rstandard(fit)

Run the code above in your browser using DataLab