Qyplot: Analysis of Variance Plot for Regression

QyplotR Documentation

Analysis of Variance Plot for Regression

Description

This function analyzes regression data graphically. It allows visualization of the usual F-test for significance of regression.

Usage

Qyplot(X, y, plotIt=TRUE, sortTrt=FALSE, type="hist", includeIntercept=TRUE, labels=FALSE)

Arguments

X

The design matrix.

y

A numeric vector containing the response.

plotIt

Logical: if TRUE, a graph is drawn.

sortTrt

Logical: if TRUE, an attempt is made at sorting the predictor effects in descending order.

type

"QQ" or "hist"

includeIntercept

Logical: if TRUE, the intercept effect is plotted; otherwise, it is omitted from the plot.

labels

logical: if TRUE, names of predictor variables are used as labels; otherwise, the design matrix column numbers are used as labels

Value

A QQ-plot or a histogram and rugplot, or a list if plotIt=FALSE

Author(s)

W. John Braun

Source

Braun, W.J. 2013. Regression Analysis and the QR Decomposition. Preprint.

Examples

# Example 1
X <- p4.18[,-4]
y <- p4.18[,4]
Qyplot(X, y, type="hist", includeIntercept=FALSE)
title("Evidence of Regression in the Jojoba Oil Data")
# Example 2
set.seed(4571)
Z <- matrix(rnorm(400), ncol=10)
A <- matrix(rnorm(81), ncol=9)
simdata <- data.frame(Z[,1], crossprod(t(Z[,-1]),A))
names(simdata) <- c("y", paste("x", 1:9, sep=""))
Qyplot(simdata[,-1], simdata[,1], type="hist", includeIntercept=FALSE)
title("Evidence of Regression in Simulated Data Set")
# Example 3
Qyplot(table.b1[,-1], table.b1[,1], type="hist", includeIntercept=FALSE)
title("Evidence of Regression in NFL Data Set")
# An example where stepwise AIC selects the complement
# of the set of variables that are actually in the true model:
X <- pathoeg[,-10]
y <- pathoeg[,10]
par(mfrow=c(2,2))
Qyplot(X, y)
Qyplot(X, y, sortTrt=TRUE)
Qyplot(X, y, type="QQ")
Qyplot(X, y, sortTrt=TRUE, type="QQ")
X <- table.b1[,-1]  # NFL data
y <- table.b1[,1]
Qyplot(X, y)


MPV documentation built on Sept. 11, 2024, 6:51 p.m.

Related to Qyplot in MPV...