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.
# S3 method for zlm
rstandard(model, lever = zhatvalues(model), ...)
A complex vector of length equal to that of the residuals of model
. Numeric for numeric input.
An object of class "zlm", "rzlm", "lm", or "rlm". Can be complex or numeric.
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
.
The standardized residuals are calculated as,
Where
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