R/plot.QRS.R

Defines functions plot.QRS

Documented in plot.QRS

plot.QRS <- function(x, normqq = FALSE, scaleloc = FALSE, ...){
    res <- x$residuals
    fit <- x$fitted.values
    if (normqq) {
        qqnorm(res, ...)
        qqline(res)
    } else {
        if (scaleloc) {
            sigma <- sqrt(x$sigma2)
            stres <- res/sigma
            sqstres <- sqrt(abs(stres))
            plot(sqstres ~ fit, xlab = "Fitted values", ylab = expression(sqrt(abs("Standardized residuals"))), ...)
            lines(lowess(fit, sqstres), col=2)
        } else {
            plot(fit, res, type = 'p', main = "Residuals vs Fitted Values",
                xlab = "Fitted", ylab = "Residual", ...)
            abline(h = 0, lty = 2)
            lines(lowess(fit, res), col=2)
        }
    }
    invisible()
}

Try the ADVICE package in your browser

Any scripts or data that you put into this service are public.

ADVICE documentation built on April 16, 2021, 9:07 a.m.